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 + + + + +