File tree Expand file tree Collapse file tree
l10n_it_withholding_tax/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22# Copyright 2018 Lorenzo Battistini - Agile Business Group
33# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44
5-
65from odoo import models , fields , api , _
76import odoo .addons .decimal_precision as dp
87from 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
280307class AccountFiscalPosition (models .Model ):
281308 _inherit = "account.fiscal.position"
You can’t perform that action at this time.
0 commit comments