diff --git a/payroll_account/models/hr_payroll_account.py b/payroll_account/models/hr_payroll_account.py index c09eca6f..cc85670a 100644 --- a/payroll_account/models/hr_payroll_account.py +++ b/payroll_account/models/hr_payroll_account.py @@ -111,13 +111,15 @@ def action_payslip_done(self): debit_account_id = line.salary_rule_id.account_debit.id credit_account_id = line.salary_rule_id.account_credit.id account_id = debit_account_id or credit_account_id - analytic_salary_id = line.salary_rule_id.analytic_account_id.id - move_line_analytic_ids = [] - if analytic_salary_id: - move_line_analytic_ids.append((4, analytic_salary_id.id)) - elif slip.contract_id.analytic_account_id: - move_line_analytic_ids.append( - (4, slip.contract_id.analytic_account_id.id) + analytic_salary_id = line.salary_rule_id.analytic_account_id + move_line_analytic_ids = {} + if slip.contract_id.analytic_account_id: + move_line_analytic_ids.update( + {line.slip_id.contract_id.analytic_account_id.id: 100} + ) + elif analytic_salary_id: + move_line_analytic_ids.update( + {line.salary_rule_id.analytic_account_id.id: 100} ) tax_ids = False @@ -186,7 +188,7 @@ def action_payslip_done(self): "date": date, "debit": amount > 0.0 and amount or 0.0, "credit": amount < 0.0 and -amount or 0.0, - "analytic_line_ids": move_line_analytic_ids, + "analytic_distribution": move_line_analytic_ids, "tax_line_id": line.salary_rule_id.account_tax_id.id, "tax_ids": tax_ids, "tax_repartition_line_id": tax_repartition_line_id, @@ -209,7 +211,7 @@ def action_payslip_done(self): "date": date, "debit": amount < 0.0 and -amount or 0.0, "credit": amount > 0.0 and amount or 0.0, - "analytic_line_ids": move_line_analytic_ids, + "analytic_distribution": move_line_analytic_ids, "tax_line_id": line.salary_rule_id.account_tax_id.id, "tax_ids": tax_ids, "tax_repartition_line_id": tax_repartition_line_id,