From 482a0385cd61c7297a50cf780e97c60c371b341b Mon Sep 17 00:00:00 2001 From: el Mau Date: Thu, 12 Jan 2023 00:33:11 -0600 Subject: [PATCH] Fix in complement pay without taxes --- source/app/controllers/cfdi_xml.py | 7 +++++-- source/app/models/main.py | 16 +++++++++------- source/static/js/controller/bancos.js | 5 ++++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/source/app/controllers/cfdi_xml.py b/source/app/controllers/cfdi_xml.py index 85ea645..9fc9322 100644 --- a/source/app/controllers/cfdi_xml.py +++ b/source/app/controllers/cfdi_xml.py @@ -594,7 +594,9 @@ class CFDI(object): for row in relacionados: taxes = row.pop('taxes') node = ET.SubElement(node_pago, f'{pre}:DoctoRelacionado', row) - node_tax = ET.SubElement(node, f'{pre}:ImpuestosDR') + nodex_tax = None + if taxes['traslados'] or taxes['retenciones']: + node_tax = ET.SubElement(node, f'{pre}:ImpuestosDR') if taxes['retenciones']: node = ET.SubElement(node_tax, f'{pre}:RetencionesDR') for tax in taxes['retenciones']: @@ -604,7 +606,8 @@ class CFDI(object): for tax in taxes['traslados']: ET.SubElement(node, f'{pre}:TrasladoDR', tax) - node_tax = ET.SubElement(node_pago, f'{pre}:ImpuestosP') + if taxes_pay['traslados'] or taxes_pay['retenciones']: + node_tax = ET.SubElement(node_pago, f'{pre}:ImpuestosP') if taxes_pay['retenciones']: node = ET.SubElement(node_tax, f'{pre}:RetencionsP') for key, importe in taxes_pay['retenciones'].items(): diff --git a/source/app/models/main.py b/source/app/models/main.py index 5416005..66f4724 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -7581,7 +7581,10 @@ class CfdiPagos(BaseModel): # REVISAR r['EquivalenciaDR'] = '1' - r['ObjetoImpDR'] = '02' + + r['ObjetoImpDR'] = '01' + if r['taxes']['traslados'] or r['taxes']['retenciones']: + r['ObjetoImpDR'] = '02' r['ImpSaldoAnt'] = FORMAT.format(r['ImpSaldoAnt']) r['ImpPagado'] = FORMAT.format(r['ImpPagado']) @@ -7610,10 +7613,11 @@ class CfdiPagos(BaseModel): taxes_pay['traslados'][k]['BaseP'] = FORMAT.format(tax_base) taxes_pay['traslados'][k]['ImporteP'] = FORMAT.format(importe) - taxes_pay['totales'] = { - 'TotalTrasladosBaseIVA16': FORMAT.format(total_tax_iva_16_base), - 'TotalTrasladosImpuestoIVA16': FORMAT.format(total_tax_iva_16_importe), - } + if taxes_pay['traslados']: + taxes_pay['totales'] = { + 'TotalTrasladosBaseIVA16': FORMAT.format(total_tax_iva_16_base), + 'TotalTrasladosImpuestoIVA16': FORMAT.format(total_tax_iva_16_importe), + } return related, taxes_pay @@ -10718,8 +10722,6 @@ def get_cp(cp): else: data['colonia'] = [r[3] for r in rows] - print('CP', cp, data) - return data diff --git a/source/static/js/controller/bancos.js b/source/static/js/controller/bancos.js index ae95103..45a5b9f 100644 --- a/source/static/js/controller/bancos.js +++ b/source/static/js/controller/bancos.js @@ -953,6 +953,7 @@ function cmd_complemento_pago_click(){ } set_data_pay(row) + $$('chk_pay_close_when_stamp').setValue(false) $$('multi_bancos').setValue('bank_pay') } @@ -1013,7 +1014,9 @@ function send_stamp_cfdi_pay(id_mov){ } }) - $$('multi_bancos').setValue('banco_home') + if(close){ + $$('multi_bancos').setValue('banco_home') + } }