From a6c221077052b49733c0719e53ad2d1540fa484b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levent=20Karaka=C5=9F?= Date: Mon, 20 Feb 2017 17:19:12 +0200 Subject: [PATCH] [FIX] hr_payroll: sum correctly category code If amount = 1 and the category amount = -1, the sum is 0 and the returned value was amount instead of zero (`0 or amount`) Avoid this evalution error by splitting on multiple lines Closes #15470 --- addons/hr_payroll/hr_payroll.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 7921fada640..9d14545a462 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -474,7 +474,9 @@ class hr_payslip(osv.osv): def _sum_salary_rule_category(localdict, category, amount): if category.parent_id: localdict = _sum_salary_rule_category(localdict, category.parent_id, amount) - localdict['categories'].dict[category.code] = category.code in localdict['categories'].dict and localdict['categories'].dict[category.code] + amount or amount + if category.code in localdict['categories'].dict: + amount += localdict['categories'].dict[category.code] + localdict['categories'].dict[category.code] = amount return localdict class BrowsableObject(object):