diff --git a/l10n_it_withholding_tax/models/account.py b/l10n_it_withholding_tax/models/account.py index 5767032ef1dd..09491de70ffe 100644 --- a/l10n_it_withholding_tax/models/account.py +++ b/l10n_it_withholding_tax/models/account.py @@ -75,7 +75,11 @@ def create(self, vals): ) == 1 ): - vals.update({"amount": invoice.amount_net_pay}) + vals.update({ + "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) @@ -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") )