Commit def0ca19 authored by Jesús Alberto Lomas Simón's avatar Jesús Alberto Lomas Simón Committed by agb80

feat(account.move): genera el XML en una factura con varios impuestos

En una factura con varios impuestos no se estaba generando correctamente
el XML porque todos los impuestos se sumaban en una sóla línea. Con este
cambio se corrige ese comportamiento
parent 86410088
Pipeline #24121 canceled with stages
......@@ -68,12 +68,14 @@ class AccountMove(models.Model):
"total_locales": 0.0,
}
tax_repartion_lines = self.line_ids.filtered('tax_repartition_line_id')
for line in self.invoice_line_ids:
for tax in line.export_invoice_line_for_xml().taxes:
# Mimic logic from compute function in account.invoice.tax
# object to group taxes from invoice lines and be able to get
# the same result for display on CFDI
grouping_dict = self._get_tax_grouping_key_from_tax_line(line)
tax_line = tax_repartion_lines.filtered(lambda l: l.tax_line_id.id == tax.id)
grouping_dict = self._get_tax_grouping_key_from_tax_line(tax_line)
grouping_key = "-".join(str(v) for v in grouping_dict.values())
if grouping_key not in tax_grouped:
tax_grouped[grouping_key] = tax
......
......@@ -99,8 +99,9 @@
t-attf-Impuesto="{{ tax.xml_name }}"
t-attf-Importe="{{ tax.xml_amount }}" />
</cfdi:Retenciones>
<cfdi:Traslados t-if="taxes['traslados']">
<cfdi:Traslado t-foreach="taxes['traslados']" t-as="tax"
<cfdi:Traslados t-if="line.impuestos['traslados']">
<t t-set="impuestos" t-value="line.impuestos"/>
<cfdi:Traslado t-foreach="impuestos['traslados']" t-as="tax"
t-att-Base="format_float(tax.base, o.currency_id.decimal_places)"
t-attf-Impuesto="{{ tax.xml_name }}"
t-attf-TipoFactor="{{ tax.type }}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment