From 1b33413de2416c95607fc29c6579ae6ded2887b8 Mon Sep 17 00:00:00 2001 From: el Mau Date: Fri, 10 Mar 2023 14:55:57 -0600 Subject: [PATCH] Fix in invoice pay --- source/app/models/main.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/app/models/main.py b/source/app/models/main.py index 625d5cc..7174c1b 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -7630,9 +7630,15 @@ class CfdiPagos(BaseModel): tipo_factor = 'Cuota' import_dr = round(tax.importe * tax_proporcion, 2) - xml_importe = FORMAT.format(import_dr) base_dr = round(tax.base * tax_proporcion, 2) + + new_import_tax = round(base_dr * tax.impuesto.tasa, 2) + while new_import_tax > import_dr: + base_dr -= Decimal(0.01) + new_import_tax = round(base_dr * tax.impuesto.tasa, 2) + xml_tax_base = FORMAT.format(base_dr) + xml_importe = FORMAT.format(import_dr) values = { "BaseDR": xml_tax_base, @@ -7641,6 +7647,7 @@ class CfdiPagos(BaseModel): "TasaOCuotaDR": str(tax.impuesto.tasa), "ImporteDR": xml_importe, } + tax_key = tax.impuesto.key if tax.impuesto.tipo == 'T': traslados.append(values) @@ -7739,6 +7746,10 @@ class CfdiPagos(BaseModel): current_tax = f'{tax_type}|{tax_tasa}' if current_tax == TAX_IVA_16: + new_import_tax = round(Decimal(tax_tasa) * tax_base, 2) + while new_import_tax > importe: + tax_base -= Decimal(0.01) + new_import_tax = round(Decimal(tax_tasa) * tax_base, 2) total_tax_iva_16_base += tax_base total_tax_iva_16_importe += importe elif current_tax == TAX_IVA_0: