Skip to content

Commit

Permalink
Merge PR #3781 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by sergiocorato
  • Loading branch information
OCA-git-bot committed May 9, 2024
2 parents a143db2 + 688da72 commit f01490d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 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(
{
"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 All @@ -98,6 +104,10 @@ def create(self, vals):
invoice.withholding_tax_line_ids
and not self._context.get("no_generate_wt_move")
and not is_wt_move
and (
ld.account_internal_type in ("receivable", "payable")
or lc.account_internal_type in ("receivable", "payable")
)
):
# and not wt_existing_moves\
reconcile.generate_wt_moves(is_wt_move)
Expand Down Expand Up @@ -375,6 +385,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 f01490d

Please sign in to comment.