From 5057ac57aef1a8451a020518ecb9204a53f325fa Mon Sep 17 00:00:00 2001 From: El Mau Date: Sun, 5 Nov 2023 22:13:45 -0600 Subject: [PATCH] Fix for CFDI egreso for General Public --- source/app/controllers/cfdi_xml.py | 9 +++++++-- source/static/js/controller/invoices.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/app/controllers/cfdi_xml.py b/source/app/controllers/cfdi_xml.py index 9c41719..d66a39d 100644 --- a/source/app/controllers/cfdi_xml.py +++ b/source/app/controllers/cfdi_xml.py @@ -28,6 +28,7 @@ log = Logger('XML') CFDI_ACTUAL = 'cfdi40' NOMINA_ACTUAL = 'nomina12' PUBLIC = 'PUBLICO EN GENERAL' +CFDI_EGRESO = 'E' DEFAULT = { 'exportacion': '01', @@ -142,6 +143,7 @@ class CFDI(object): self._carta_porte = False self._comercio_exterior = False self._divisas = '' + self._tipo_de_comprobante = '' self.error = '' def _now(self): @@ -288,6 +290,8 @@ class CFDI(object): if not 'Exportacion' in attributes: attributes['Exportacion'] = DEFAULT['exportacion'] + self._tipo_de_comprobante = attributes['TipoDeComprobante'] + self._cfdi = ET.Element('{}:Comprobante'.format(self._pre), attributes) return @@ -319,8 +323,9 @@ class CFDI(object): def _receptor(self, datos): receptor_name = datos['Nombre'].upper() - if receptor_name != PUBLIC: - datos['Nombre'] = receptor_name + if receptor_name == PUBLIC and self._tipo_de_comprobante == CFDI_EGRESO: + receptor_name = datos['Nombre'] + datos['Nombre'] = receptor_name node_name = '{}:Receptor'.format(self._pre) emisor = ET.SubElement(self._cfdi, node_name, datos) return diff --git a/source/static/js/controller/invoices.js b/source/static/js/controller/invoices.js index 3eaa537..3cd16b4 100644 --- a/source/static/js/controller/invoices.js +++ b/source/static/js/controller/invoices.js @@ -998,7 +998,7 @@ function set_client(row){ } lst.setValue(lst.getPopup().getList().getFirstId()) - if(row.nombre == PUBLICO && row.rfc == RFC_PUBLICO){ + if(row.nombre.toUpperCase() == PUBLICO && row.rfc == RFC_PUBLICO){ show('cmd_show_global_information', true) }else{ show('cmd_show_global_information', false)