Fix in invoice pay

This commit is contained in:
el Mau 2023-03-10 14:55:57 -06:00
parent 834c1faae6
commit 1b33413de2
1 changed files with 12 additions and 1 deletions

View File

@ -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: