[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
This commit is contained in:
Levent Karakaş 2017-02-20 17:19:12 +02:00 committed by Martin Trigaux
parent 0616016b47
commit a6c2210770
1 changed files with 3 additions and 1 deletions

View File

@ -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):