From cee7b7cb1fb28c1c84cdbb0b4658623188e9e259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Mac=20Rouillon?= Date: Thu, 10 Dec 2020 13:51:00 +0000 Subject: [PATCH] [FIX] l10n_latam_invoice_document: For the latam invoice reporte show the base property in the correct value and currency The problem that occurs before of this commit, is due the base of the taxes is in the currency of the company not in the invoice currency. For that the value that shows in this cases for the base is not correponding for the symbol of the currency. After this changes we show the correct value an symbol for the base converting the value when is necessary. X-original-commit: 4fd4f82ecd1b97f608168baaa780844f68e8a9d7 --- addons/l10n_latam_invoice_document/models/account_move.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/l10n_latam_invoice_document/models/account_move.py b/addons/l10n_latam_invoice_document/models/account_move.py index 85b0f16c987..e86462e20fe 100644 --- a/addons/l10n_latam_invoice_document/models/account_move.py +++ b/addons/l10n_latam_invoice_document/models/account_move.py @@ -237,8 +237,12 @@ class AccountMove(models.Model): res[line.tax_line_id.tax_group_id]['amount'] += line.price_subtotal tax_key_add_base = tuple(move._get_tax_key_for_group_add_base(line)) if tax_key_add_base not in done_taxes: + if line.currency_id and line.company_currency_id and line.currency_id != line.company_currency_id: + amount = line.company_currency_id._convert(line.tax_base_amount, line.currency_id, line.company_id, line.date or fields.Date.today()) + else: + amount = line.tax_base_amount # The base should be added ONCE - res[line.tax_line_id.tax_group_id]['base'] += line.tax_base_amount + res[line.tax_line_id.tax_group_id]['base'] += amount done_taxes.add(tax_key_add_base) res = sorted(res.items(), key=lambda l: l[0].sequence) move.amount_by_group = [(