Skip to content

Commit

Permalink
[FIX] Fix analytic account in payroll account
Browse files Browse the repository at this point in the history
  • Loading branch information
cvinh authored and hapolinario committed May 23, 2024
1 parent 5636a62 commit 34cf783
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions payroll_account/models/hr_payroll_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(

Check warning on line 117 in payroll_account/models/hr_payroll_account.py

View check run for this annotation

Codecov / codecov/patch

payroll_account/models/hr_payroll_account.py#L117

Added line #L117 was not covered by tests
{line.slip_id.contract_id.analytic_account_id.id: 100}
)
elif analytic_salary_id:
move_line_analytic_ids.update(

Check warning on line 121 in payroll_account/models/hr_payroll_account.py

View check run for this annotation

Codecov / codecov/patch

payroll_account/models/hr_payroll_account.py#L121

Added line #L121 was not covered by tests
{line.salary_rule_id.analytic_account_id.id: 100}
)

tax_ids = False
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 34cf783

Please sign in to comment.