[FIX] hr_payroll_account: analytic account

- Set an analytic account on an employee contract
- Set credit and debit accounts on the salary rules
- Create a payslip, confirm

The journal items created do not use the analytic account set on the
contract.

If no analytic account is set on the salary rule, we fall back on the
contract account.

opw-2006090

closes odoo/odoo#34095

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-06-13 11:14:39 +00:00
parent 9993f9c9f9
commit 4b8f72eb23
@@ -85,7 +85,7 @@ class HrPayslip(models.Model):
'date': date,
'debit': amount > 0.0 and amount or 0.0,
'credit': amount < 0.0 and -amount or 0.0,
'analytic_account_id': line.salary_rule_id.analytic_account_id.id,
'analytic_account_id': line.salary_rule_id.analytic_account_id.id or slip.contract_id.analytic_account_id.id,
'tax_line_id': line.salary_rule_id.account_tax_id.id,
})
line_ids.append(debit_line)
@@ -100,7 +100,7 @@ class HrPayslip(models.Model):
'date': date,
'debit': amount < 0.0 and -amount or 0.0,
'credit': amount > 0.0 and amount or 0.0,
'analytic_account_id': line.salary_rule_id.analytic_account_id.id,
'analytic_account_id': line.salary_rule_id.analytic_account_id.id or slip.contract_id.analytic_account_id.id,
'tax_line_id': line.salary_rule_id.account_tax_id.id,
})
line_ids.append(credit_line)