diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py index e624bc2..9653acc 100644 --- a/source/app/controllers/util.py +++ b/source/app/controllers/util.py @@ -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) diff --git a/source/app/models/main.py b/source/app/models/main.py index 48f2be3..625d5cc 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -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: diff --git a/source/templates/plantilla_factura_4.0.ods b/source/templates/plantilla_factura_4.0.ods index 0479ae6..bf9585a 100644 Binary files a/source/templates/plantilla_factura_4.0.ods and b/source/templates/plantilla_factura_4.0.ods differ