|
2 | 2 | # Copyright 2018 Lorenzo Battistini - Agile Business Group |
3 | 3 | # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
4 | 4 |
|
5 | | - |
6 | 5 | from odoo import models, fields, api, _ |
7 | 6 | import odoo.addons.decimal_precision as dp |
8 | 7 | from odoo.exceptions import ValidationError |
9 | | -from odoo.tools.misc import formatLang |
10 | 8 |
|
11 | 9 |
|
12 | 10 | class AccountPartialReconcile(models.Model): |
@@ -284,31 +282,26 @@ def prepare_move_lines_for_reconciliation_widget( |
284 | 282 | """ |
285 | 283 | Net amount for invoices with withholding tax |
286 | 284 | """ |
287 | | - res = super(AccountMoveLine, self).prepare_move_lines_for_reconciliation_widget( |
| 285 | + res = super( |
| 286 | + AccountMoveLine, self |
| 287 | + ).prepare_move_lines_for_reconciliation_widget( |
288 | 288 | target_currency, target_date) |
289 | 289 | for dline in res: |
290 | 290 | if 'id' in dline and dline['id']: |
291 | 291 | 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 |
295 | 292 | 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 |
299 | 299 | 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 | + ) |
312 | 305 | return res |
313 | 306 |
|
314 | 307 |
|
|
0 commit comments