Skip to content

Commit

Permalink
[FIX][l10n_it_withholding_tax] Fix amount residual reconciled for inv…
Browse files Browse the repository at this point in the history
…oice with withholding tax

Co-authored-by: Alessandro Camilli <[email protected]>
  • Loading branch information
2 people authored and OCA-git-bot committed Feb 27, 2024
1 parent ad3799f commit b149c8c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion l10n_it_withholding_tax/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ def create(self, vals):
)
== 1
):
vals.update({"amount": invoice.amount_net_pay})
vals.update(

Check warning on line 78 in l10n_it_withholding_tax/models/account.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_withholding_tax/models/account.py#L78

Added line #L78 was not covered by tests
{
"amount": invoice.amount_net_pay,
"credit_amount_currency": invoice.amount_net_pay,
"debit_amount_currency": invoice.amount_net_pay,
}
)

# Create reconciliation
reconcile = super(AccountPartialReconcile, self).create(vals)
Expand Down Expand Up @@ -375,6 +381,13 @@ def _compute_amount_withholding_tax(self):
for line in reconciled_amls:
if not line.withholding_tax_generated_by_move_id:
amount_net_pay_residual -= line.debit or line.credit
if (
float_compare(
amount_net_pay_residual, 0, dp_obj.precision_get("Account")
)
== -1
):
amount_net_pay_residual = 0
invoice.amount_net_pay_residual = float_round(
amount_net_pay_residual, dp_obj.precision_get("Account")
)
Expand Down

0 comments on commit b149c8c

Please sign in to comment.