Skip to content

Commit

Permalink
[14.0][FIX] l10n_it_withholding_tax pagamento con spese
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocorato committed Jun 26, 2024
1 parent 27ffd89 commit 09cad28
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion l10n_it_withholding_tax/wizards/account_payment_register.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2023 Simone Rubino - TAKOBI
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models
from odoo import api, fields, models
from odoo.tools import float_is_zero


Expand Down Expand Up @@ -38,3 +38,22 @@ def _inject_withholding_net_pay_residual(self, wizard_values_from_batch):
"source_amount_currency"
] = net_pay_residual_amount
return wizard_values_from_batch

@api.depends('amount')
def _compute_payment_difference(self):
super()._compute_payment_difference()
for wizard in self:
withholding_amount = sum(
wizard.mapped("line_ids.withholding_tax_amount") or [])
if wizard.source_currency_id == wizard.currency_id:
# Same currency, probably the only needed here.
wizard.payment_difference = (
wizard.source_amount_currency - withholding_amount - wizard.amount)
elif wizard.currency_id == wizard.company_id.currency_id:
# probably not needed as withholding amount does not know currency
# Payment expressed on the company's currency.
wizard.payment_difference = (

Check warning on line 55 in l10n_it_withholding_tax/wizards/account_payment_register.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_withholding_tax/wizards/account_payment_register.py#L55

Added line #L55 was not covered by tests
wizard.source_amount - withholding_amount - wizard.amount)
# not supported from withholding:
# Foreign currency on payment different from the one set on the journal
# entries.

0 comments on commit 09cad28

Please sign in to comment.