[FIX] l10n_fr_hr_payroll: use `child_of`
Previous commit 8f7129216
searches recursively for children of a rule
category. Use `child_of` instead which is way more efficient.
opw-673222
This commit is contained in:
parent
8f71292162
commit
26b3501ca9
|
@ -48,24 +48,15 @@ class fiche_paye_parser(report_sxw.rml_parse):
|
||||||
res = payslip_line.browse(self.cr, self.uid, ids)
|
res = payslip_line.browse(self.cr, self.uid, ids)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_children_categories(self, cate_ids):
|
|
||||||
rule_cate_obj = self.pool.get('hr.salary.rule.category')
|
|
||||||
new_cate_ids = rule_cate_obj.search(self.cr, self.uid, [('parent_id', 'in', cate_ids)])
|
|
||||||
if new_cate_ids:
|
|
||||||
return cate_ids + self._get_children_categories(new_cate_ids)
|
|
||||||
else:
|
|
||||||
return cate_ids
|
|
||||||
|
|
||||||
def get_total_by_rule_category(self, obj, code):
|
def get_total_by_rule_category(self, obj, code):
|
||||||
payslip_line = self.pool.get('hr.payslip.line')
|
payslip_line = self.pool.get('hr.payslip.line')
|
||||||
rule_cate_obj = self.pool.get('hr.salary.rule.category')
|
rule_cate_obj = self.pool.get('hr.salary.rule.category')
|
||||||
|
|
||||||
cate_ids = rule_cate_obj.search(self.cr, self.uid, [('code', '=', code)])
|
cate_ids = rule_cate_obj.search(self.cr, self.uid, [('code', '=', code)])
|
||||||
cate_ids = self._get_children_categories(cate_ids)
|
|
||||||
|
|
||||||
category_total = 0
|
category_total = 0
|
||||||
if cate_ids:
|
if cate_ids:
|
||||||
line_ids = payslip_line.search(self.cr, self.uid, [('slip_id', '=', obj.id), ('category_id', 'in', cate_ids)])
|
line_ids = payslip_line.search(self.cr, self.uid, [('slip_id', '=', obj.id), ('category_id', 'child_of', cate_ids)])
|
||||||
for line in payslip_line.browse(self.cr, self.uid, line_ids):
|
for line in payslip_line.browse(self.cr, self.uid, line_ids):
|
||||||
category_total += line.total
|
category_total += line.total
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue