From 1c7c29eeab4c9f8ddefdbf49366475986d486323 Mon Sep 17 00:00:00 2001 From: Pablo Montenegro Date: Wed, 23 Nov 2022 16:23:03 +0000 Subject: [PATCH] [FIX] l10n_ar: total invoice amount on printed invoice Total amount on printed electronic invoice include taxes if the electronic invoice has argentinian vat and document type 'B', 'C', 'X', 'R'. Also if the invoice mentioned before have more than one tax and one of them is different than "IVA" (argentinian vat), then is necessary not to show in the printed invoice report the amount untaxed of the invoice. closes odoo/odoo#111776 Task: 922 X-original-commit: f5c0552a2b2e975db8745219af044638449c3312 Signed-off-by: Josse Colpaert --- addons/l10n_ar/models/account_move.py | 10 +++++++++- addons/l10n_ar/views/report_invoice.xml | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/addons/l10n_ar/models/account_move.py b/addons/l10n_ar/models/account_move.py index c5ed4d1fbab..1df20af7e82 100644 --- a/addons/l10n_ar/models/account_move.py +++ b/addons/l10n_ar/models/account_move.py @@ -319,6 +319,7 @@ class AccountMove(models.Model): return super()._get_name_invoice_report() def _l10n_ar_get_invoice_totals_for_report(self): + """If the invoice document type indicates that vat should not be detailed in the printed report (result of _l10n_ar_include_vat()) then we overwrite tax_totals field so that includes taxes in the total amount, otherwise it would be showing amount_untaxed in the amount_total""" self.ensure_one() include_vat = self._l10n_ar_include_vat() base_lines = self.line_ids.filtered(lambda x: x.display_type == 'product') @@ -341,12 +342,19 @@ class AccountMove(models.Model): if not x['tax_repartition_line'].tax_id.tax_group_id.l10n_ar_vat_afip_code ] - return self.env['account.tax']._prepare_tax_totals( + tax_totals = self.env['account.tax']._prepare_tax_totals( base_line_vals_list, self.currency_id, tax_lines=tax_line_vals_list, ) + if include_vat: + temp = self.tax_totals + tax_totals['amount_total'] = temp['amount_total'] + tax_totals['formatted_amount_total'] = temp['formatted_amount_total'] + + return tax_totals + def _l10n_ar_include_vat(self): self.ensure_one() return self.l10n_latam_document_type_id.l10n_ar_letter in ['B', 'C', 'X', 'R'] diff --git a/addons/l10n_ar/views/report_invoice.xml b/addons/l10n_ar/views/report_invoice.xml index 59a842bf983..0932ca7bcac 100644 --- a/addons/l10n_ar/views/report_invoice.xml +++ b/addons/l10n_ar/views/report_invoice.xml @@ -262,6 +262,17 @@

+ + l10n_ar.document_tax_totals + + + + +