Skip to content

Commit 6c93f64

Browse files
authored
Merge pull request #604 from eLBati/11.0-WT_netto_bank_statement
11.0 Riconciliazione bancaria con importo al netto della ritenuta
2 parents 3ee0855 + 724361f commit 6c93f64

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

l10n_it_withholding_tax/models/account.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Copyright 2018 Lorenzo Battistini - Agile Business Group
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
65
from odoo import models, fields, api, _
76
import odoo.addons.decimal_precision as dp
87
from odoo.exceptions import ValidationError
@@ -276,6 +275,34 @@ def remove_move_reconcile(self):
276275

277276
return super(AccountMoveLine, self).remove_move_reconcile()
278277

278+
@api.multi
279+
def prepare_move_lines_for_reconciliation_widget(
280+
self, target_currency=False, target_date=False):
281+
"""
282+
Net amount for invoices with withholding tax
283+
"""
284+
res = super(
285+
AccountMoveLine, self
286+
).prepare_move_lines_for_reconciliation_widget(
287+
target_currency, target_date)
288+
for dline in res:
289+
if 'id' in dline and dline['id']:
290+
line = self.browse(dline['id'])
291+
if line.withholding_tax_amount:
292+
dline['debit'] = (
293+
line.debit - line.withholding_tax_amount if line.debit
294+
else 0
295+
)
296+
dline['credit'] = (
297+
line.credit - line.withholding_tax_amount
298+
if line.credit else 0
299+
)
300+
dline['name'] += (
301+
_(' (Net to pay: %s)')
302+
% (dline['debit'] or dline['credit'])
303+
)
304+
return res
305+
279306

280307
class AccountFiscalPosition(models.Model):
281308
_inherit = "account.fiscal.position"

0 commit comments

Comments
 (0)