Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX][l10n_it_withholding_tax] Fix amount residual reconciled for inv… #3781

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
)
== 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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non so se ci sia la casistica di una fattura emessa in valuta con ritenuta d'acconto, sarebbe da verificare se la valuta della fattura è uguale alla valuta aziendale e in caso contrario convertire no?

"debit_amount_currency": invoice.amount_net_pay,
}
)

# Create reconciliation
reconcile = super(AccountPartialReconcile, self).create(vals)
Expand All @@ -98,6 +104,10 @@
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 @@
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
Loading