From f52463c9dc754f3b0b814278030034afe6d588da Mon Sep 17 00:00:00 2001 From: "jesus.lomas" <jesus.lomas@openpyme.mx> Date: Tue, 10 Dec 2024 16:47:39 -0600 Subject: [PATCH] feat(account.move): corrige el timbrado de retenciones En facturas con retenciones de impuestos los impuestos no estaban considerados correctamente por lo que no se generaba el XML correspondiente. --- l10n_mx_facturae/models/account_move.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/l10n_mx_facturae/models/account_move.py b/l10n_mx_facturae/models/account_move.py index 4faaff9983..8bd86a8a42 100644 --- a/l10n_mx_facturae/models/account_move.py +++ b/l10n_mx_facturae/models/account_move.py @@ -50,7 +50,7 @@ class AccountMove(models.Model): self.subtotal - self.descuento + self.impuestos["total_traslados"] - + self.impuestos["total_retenciones"] + - self.impuestos["total_retenciones"] + self.impuestos["total_locales"] ) @@ -86,16 +86,17 @@ class AccountMove(models.Model): # Classify taxes for CFDI for dummy, tax in tax_grouped.items(): if tax.group in ["IVA", "IEPS", "ISR"]: - tax.xml_amount = "{0:.2f}".format(tax.amount) + tax.xml_amount = "{0:.2f}".format(abs(tax.amount)) if tax.amount >= 0: taxes["traslados"].append(tax) taxes["total_traslados"] += tax.amount else: taxes["retenciones"].append(tax) - taxes["total_retenciones"] += tax.amount + taxes["total_retenciones"] += abs(tax.amount) else: taxes["locales"].append(tax) taxes["total_locales"] += tax.amount + return taxes # pylint: disable=W0212 @@ -708,7 +709,7 @@ class AccountMoveLine(models.Model): "002" if tax_group.name == "IVA" else "003" ) tax["type"] = tax_record.l10n_mx_tax_type - tax["xml_amount"] = "{0:.2f}".format(tax["amount"]) + tax["xml_amount"] = "{0:.2f}".format(abs(tax["amount"])) tax["TasaOCuota"] = "{0:.6f}".format(abs(tax_record.amount)/100) return tax -- GitLab