Skip to content

Commit 0f5e43f

Browse files
committed
IMP l10n_it_withholding_tax show net to pay in reconciliation line
1 parent 449213b commit 0f5e43f

1 file changed

Lines changed: 14 additions & 21 deletions

File tree

l10n_it_withholding_tax/models/account.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
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
9-
from odoo.tools.misc import formatLang
108

119

1210
class AccountPartialReconcile(models.Model):
@@ -284,31 +282,26 @@ def prepare_move_lines_for_reconciliation_widget(
284282
"""
285283
Net amount for invoices with withholding tax
286284
"""
287-
res = super(AccountMoveLine, self).prepare_move_lines_for_reconciliation_widget(
285+
res = super(
286+
AccountMoveLine, self
287+
).prepare_move_lines_for_reconciliation_widget(
288288
target_currency, target_date)
289289
for dline in res:
290290
if 'id' in dline and dline['id']:
291291
line = self.browse(dline['id'])
292-
company_currency = line.account_id.company_id.currency_id
293-
line_currency = (line.currency_id and line.amount_currency) \
294-
and line.currency_id or company_currency
295292
if line.withholding_tax_amount:
296-
dline['debit'] = line.debit - line.withholding_tax_amount \
297-
if line.debit else 0
298-
dline['credit'] = line.credit - line.withholding_tax_amount \
293+
dline['debit'] = (
294+
line.debit - line.withholding_tax_amount if line.debit
295+
else 0
296+
)
297+
dline['credit'] = (
298+
line.credit - line.withholding_tax_amount
299299
if line.credit else 0
300-
amount = line.debit or line.credit
301-
amount_str = formatLang(
302-
self.env, abs(amount), currency_obj=target_currency)
303-
amount_currency_str = ""
304-
total_amount_currency_str = ""
305-
if line_currency != target_currency:
306-
amount_currency_str = formatLang(self.env, abs(actual_debit or actual_credit), currency_obj=line_currency)
307-
total_amount_currency_str = formatLang(self.env, total_amount, currency_obj=line_currency)
308-
dline['amount_str'] = amount_str
309-
dline['total_amount_str'] = amount_str
310-
dline['amount_currency_str'] = total_amount_currency_str
311-
dline['total_amount_currency_str'] = total_amount_currency_str
300+
)
301+
dline['name'] += (
302+
_(' (Net to pay: %s)')
303+
% (dline['debit'] or dline['credit'])
304+
)
312305
return res
313306

314307

0 commit comments

Comments
 (0)