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
  • Loading branch information
alessandrocamilli committed Dec 12, 2023
1 parent 2f71528 commit 9f9c526
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 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,11 @@ 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 @@ -341,6 +345,10 @@ 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 9f9c526

Please sign in to comment.