diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2017-12-22 12:09:13 +0100 |
|---|---|---|
| committer | Nicolas Martinelli <nim-odoo@users.noreply.github.com> | 2017-12-27 14:48:25 +0100 |
| commit | 3a79d2cf2e02a2337b7dcc0a8a54dff32c6eb2b9 (patch) | |
| tree | 70b7dd2782155844234a727abed236e3315fc95c | |
| parent | ec520b871c113d2dbdf12702c6ce6f88e1d680f4 (diff) | |
[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
| -rw-r--r-- | addons/hr_payroll/models/hr_payslip.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/hr_payroll/models/hr_payslip.py b/addons/hr_payroll/models/hr_payslip.py index 3aaa01910ee..fdf93d99951 100644 --- a/addons/hr_payroll/models/hr_payslip.py +++ b/addons/hr_payroll/models/hr_payslip.py @@ -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 |
