Commit be48a140 authored by Joren Van Onder's avatar Joren Van Onder
Browse files

[FIX] hr_payroll: avoid infinite recursion

The get_recursive_parent function seemingly depended on the ordering of
the rule_categories recordset which happens to work fine in most cases
because all data first defines the parent before defining the children
rule categories. But if you happen to do it the other way around it
won't work and it will infinitely call itself because:

if rule_categories[0].parent_id:
    rule_categories = rule_categories[0].parent_id | rule_categories

won't change the value of rule_categories[0].

opw-673222 (loosely related)
parent 08416b23
......@@ -37,13 +37,16 @@ class payslip_details_report(report_sxw.rml_parse):
payslip_line = self.pool.get('hr.payslip.line')
rule_cate_obj = self.pool.get('hr.salary.rule.category')
def get_recursive_parent(rule_categories):
if not rule_categories:
return []
if rule_categories[0].parent_id:
rule_categories = rule_categories[0].parent_id | rule_categories
return rule_categories
def get_recursive_parent(current_rule_category, rule_categories = None):
if rule_categories:
rule_categories = current_rule_category | rule_categories
rule_categories = current_rule_category
if current_rule_category.parent_id:
return get_recursive_parent(current_rule_category.parent_id, rule_categories)
return rule_categories
res = []
result = {}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment