[FIX] hr_payroll: salary structure

- Create payslip
- Add a contract with any structure
- Add a structure in payslip, different from the one defined in step 2
- Confirm or compute sheet

Payslip is computed using the contract structure, while it should be
computed using the payslip structure.

Closes #21567
opw-787671
This commit is contained in:
Nicolas Martinelli
2017-12-27 14:48:25 +01:00
committed by Nicolas Martinelli
parent ec520b871c
commit 3a79d2cf2e
+4 -1
View File
@@ -311,7 +311,10 @@ class HrPayslip(models.Model):
baselocaldict = {'categories': categories, 'rules': rules, 'payslip': payslips, 'worked_days': worked_days, 'inputs': inputs}
#get the ids of the structures on the contracts and their parent id as well
contracts = self.env['hr.contract'].browse(contract_ids)
structure_ids = contracts.get_all_structures()
if len(contracts) == 1 and payslip.struct_id:
structure_ids = list(set(payslip.struct_id._get_parent_structure().ids))
else:
structure_ids = contracts.get_all_structures()
#get the rules of the structure and thier children
rule_ids = self.env['hr.payroll.structure'].browse(structure_ids).get_all_rules()
#run the rules by sequence