[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 <jco@odoo.com>
This commit is contained in:
Pablo Montenegro
2023-02-07 16:38:28 +01:00
parent c2d486eeb4
commit 1c7c29eeab
2 changed files with 20 additions and 1 deletions
+9 -1
View File
@@ -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']
+11
View File
@@ -262,6 +262,17 @@
</p>
</div>
<t t-call="account.document_tax_totals" position="attributes">
<attribute name="t-call">l10n_ar.document_tax_totals</attribute>
</t>
</template>
<template id="document_tax_totals" inherit_id="account.document_tax_totals" primary="True">
<xpath expr="//t[@t-foreach]/tr" position="attributes">
<!-- Only for the Untaxed Amount -->
<attribute name="t-if">not o._l10n_ar_include_vat()</attribute>
</xpath>
</template>
<!-- FIXME: Temp fix to allow fetching invoice_documemt in Studio Reports with localisation -->