Fix in invoice pay with tax IVA 0

This commit is contained in:
el Mau 2023-03-07 11:53:04 -06:00
parent 4dc54ade1e
commit 834c1faae6
3 changed files with 17 additions and 5 deletions

View File

@ -744,8 +744,10 @@ class LIBO(object):
self._total_cantidades += float(cantidad)
if not count:
cell_5.CellStyle = self._get_style(cell_5)
cell_6.CellStyle = self._get_style(cell_6)
if not cell_5 is None:
cell_5.CellStyle = self._get_style(cell_5)
if not cell_6 is None:
cell_6.CellStyle = self._get_style(cell_6)
return
style_5 = self._get_style(cell_5)

View File

@ -7670,6 +7670,7 @@ class CfdiPagos(BaseModel):
def _get_related_xml(self, id_mov, currency):
TAX_IVA_16 = '002|0.160000'
TAX_IVA_0 = '002|0.000000'
filters = (FacturasPagos.movimiento==id_mov)
related = tuple(FacturasPagos.select(
@ -7715,6 +7716,7 @@ class CfdiPagos(BaseModel):
del r['Serie']
total_tax_iva_16_base = 0
total_tax_iva_0_base = 0
total_tax_iva_16_importe = 0
total_tax_retenciones_isr_importe = 0
total_tax_retenciones_iva_importe = 0
@ -7735,17 +7737,25 @@ class CfdiPagos(BaseModel):
tax_base /= equivalencia
importe /= equivalencia
if f'{tax_type}|{tax_tasa}' == TAX_IVA_16:
current_tax = f'{tax_type}|{tax_tasa}'
if current_tax == TAX_IVA_16:
total_tax_iva_16_base += tax_base
total_tax_iva_16_importe += importe
elif current_tax == TAX_IVA_0:
total_tax_iva_0_base += tax_base
taxes_pay['traslados'][k]['BaseP'] = FORMAT.format(tax_base)
taxes_pay['traslados'][k]['ImporteP'] = FORMAT.format(importe)
taxes_pay['totales'] = {}
if taxes_pay['traslados']:
taxes_pay['totales']['TotalTrasladosBaseIVA16'] = FORMAT.format(total_tax_iva_16_base)
taxes_pay['totales']['TotalTrasladosImpuestoIVA16'] = FORMAT.format(total_tax_iva_16_importe)
if total_tax_iva_16_base:
taxes_pay['totales']['TotalTrasladosBaseIVA16'] = FORMAT.format(total_tax_iva_16_base)
taxes_pay['totales']['TotalTrasladosImpuestoIVA16'] = FORMAT.format(total_tax_iva_16_importe)
if total_tax_iva_0_base:
taxes_pay['totales']['TotalTrasladosBaseIVA0'] = FORMAT.format(total_tax_iva_0_base)
taxes_pay['totales']['TotalTrasladosImpuestoIVA0'] = FORMAT.format(0.0)
if taxes_pay['retenciones']:
if total_tax_retenciones_isr_importe: