diff --git a/CHANGELOG.md b/CHANGELOG.md index 497ec87..bf22d02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ -v 1.43.0 [00-Jun-2021] +v 1.42.1 [00-Jun-2021] ---------------------- - - Multialmacen + - Error - Ticket #5 v 1.42.0 [24-May-2021] diff --git a/VERSION b/VERSION index ed81e4f..75c56b2 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -1.43.0 +1.42.1 diff --git a/source/app/controllers/cfdi_xml.py b/source/app/controllers/cfdi_xml.py index 8b7a8ef..5327d9d 100644 --- a/source/app/controllers/cfdi_xml.py +++ b/source/app/controllers/cfdi_xml.py @@ -464,8 +464,17 @@ class CFDI(object): if 'ine' in datos: atributos = {'Version': SAT['ine']['version']} + ine_key_entidad = datos['ine'].pop('ClaveEntidad', '') + ine_ambito = datos['ine'].pop('Ambito', '') + if ine_key_entidad: + ine_id_conta = datos['ine'].pop('IdContabilidad', '') atributos.update(datos['ine']) - ET.SubElement(self._complemento, 'ine:INE', atributos) + node_ine = ET.SubElement(self._complemento, 'ine:INE', atributos) + if ine_key_entidad: + attr = {'ClaveEntidad': ine_key_entidad, 'Ambito': ine_ambito} + node_entidad = ET.SubElement(node_ine, 'ine:Entidad', attr) + attr = {'IdContabilidad': ine_id_conta} + ET.SubElement(node_entidad, 'ine:Contabilidad', attr) if 'pagos' in datos: datos = datos.pop('pagos') diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py index 47b9505..2084c9b 100644 --- a/source/app/controllers/util.py +++ b/source/app/controllers/util.py @@ -1897,7 +1897,31 @@ def _ine(doc, version): ) data = CaseInsensitiveDict(node.attrib.copy()) for k, v in values: - data[k] = v.format(data[k]) + if k in data: + data[k] = v.format(data[k]) + + try: + node = node[0] + attr = CaseInsensitiveDict(node.attrib.copy()) + values = ( + ('ClaveEntidad', 'Clave de la Entidad: {}'), + ('Ambito', 'Ámbito: {}'), + ) + for k, v in values: + if k in attr: + data[k] = v.format(attr[k]) + + node = node[0] + attr = CaseInsensitiveDict(node.attrib.copy()) + values = ( + ('IdContabilidad', 'ID de Contabilidad: {}'), + ) + for k, v in values: + if k in attr: + data[k] = v.format(attr[k]) + except Exception as e: + print(e) + return data diff --git a/source/app/models/main.py b/source/app/models/main.py index c04a672..3bb88b7 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -4663,6 +4663,8 @@ class Facturas(BaseModel): q.execute() q = FacturasRelacionadas.delete().where(FacturasRelacionadas.factura==obj) q.execute() + q = FacturasComplementos.delete().where(FacturasComplementos.factura==obj) + q.execute() Tickets.uncancel(obj) m = 'B {}'.format(obj.id) @@ -4846,7 +4848,6 @@ class Facturas(BaseModel): def _guardar_ine(self, invoice, valores): if not valores: return - data = { 'factura': invoice, 'nombre': 'ine', diff --git a/source/app/settings.py b/source/app/settings.py index 0f707b8..bbd535e 100644 --- a/source/app/settings.py +++ b/source/app/settings.py @@ -42,7 +42,7 @@ except ImportError: DEBUG = DEBUG -VERSION = '1.43.0' +VERSION = '1.42.1' EMAIL_SUPPORT = ('soporte@empresalibre.mx',) TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION) diff --git a/source/static/js/controller/invoices.js b/source/static/js/controller/invoices.js index c95f30f..dbb025b 100644 --- a/source/static/js/controller/invoices.js +++ b/source/static/js/controller/invoices.js @@ -452,9 +452,9 @@ function validate_invoice(values){ return false } - if(id_contabilidad.length != 6){ + if(id_contabilidad.length > 6){ $$('tv_invoice').getTabbar().setValue('INE') - msg = 'El ID de contabilidad deben ser 6 digitos' + msg = 'El ID de contabilidad deben tener máximo seis digitos' msg_error(msg) return false } @@ -666,10 +666,15 @@ function guardar_y_timbrar(values){ var usar_ine = $$('chk_cfdi_usar_ine').getValue() if(usar_ine){ + ine_type_comite = $$('lst_ine_tipo_comite').getValue() var valores = { TipoProceso: $$('lst_ine_tipo_proceso').getValue(), - TipoComite: $$('lst_ine_tipo_comite').getValue(), IdContabilidad: $$('txt_ine_idcontabilidad').getValue(), + ClaveEntidad: $$('lst_ine_key_entidad').getValue(), + Ambito: $$('lst_ine_ambito').getValue(), + } + if(ine_type_comite){ + valores['TipoComite'] = ine_type_comite } data['ine'] = valores } diff --git a/source/static/js/ui/invoices.js b/source/static/js/ui/invoices.js index 8669632..797dca8 100644 --- a/source/static/js/ui/invoices.js +++ b/source/static/js/ui/invoices.js @@ -707,12 +707,63 @@ var opt_tipo_proceso = [ var opt_tipo_comite = [ + {id: '', value: ''}, {id: 'Ejecutivo Nacional', value: 'Ejecutivo Nacional'}, {id: 'Ejecutivo Estatal', value: 'Ejecutivo Estatal'}, {id: 'Directivo Estatal', value: 'Directivo Estatal'}, ] +var opt_ine_ambito = [ + {id: '', value: ''}, + {id: 'Local', value: 'Local'}, + {id: 'Federal', value: 'Federal'}, +] + + +var opt_clave_entidad = [ + {id: '', value: ''}, + {id: 'AGU', value: 'Aguascalientes'}, + {id: 'BCN', value: 'Baja California'}, + {id: 'BCS', value: 'Baja California Sur'}, + {id: 'CAM', value: 'Campeche'}, + {id: 'CHP', value: 'Chiapas'}, + {id: 'CHH', value: 'Chihuahua'}, + {id: 'COA', value: 'Coahuila'}, + {id: 'COL', value: 'Colima'}, + {id: 'CR1', value: 'Circunscripción 1'}, + {id: 'CR2', value: 'Circunscripción 2'}, + {id: 'CR3', value: 'Circunscripción 3'}, + {id: 'CR4', value: 'Circunscripción 4'}, + {id: 'CR5', value: 'Circunscripción 5'}, + {id: 'DIF', value: 'Ciudad de México'}, + {id: 'DUR', value: 'Durango'}, + {id: 'GUA', value: 'Guanajuato'}, + {id: 'GRO', value: 'Guerrero'}, + {id: 'HID', value: 'Hidalgo'}, + {id: 'JAL', value: 'Jalisco'}, + {id: 'MEX', value: 'México'}, + {id: 'MIC', value: 'Michoacán'}, + {id: 'MOR', value: 'Morelos'}, + {id: 'NAC', value: 'Nacional'}, + {id: 'NAY', value: 'Nayarit'}, + {id: 'NLE', value: 'Nuevo León'}, + {id: 'OAX', value: 'Oaxaca'}, + {id: 'PUE', value: 'Puebla'}, + {id: 'QUE', value: 'Querétaro'}, + {id: 'ROO', value: 'Quintana Roo'}, + {id: 'SLP', value: 'San Luis Potosí'}, + {id: 'SIN', value: 'Sinaloa'}, + {id: 'SON', value: 'Sonora'}, + {id: 'TAB', value: 'Tabasco'}, + {id: 'TAM', value: 'Tamaulipas'}, + {id: 'TLA', value: 'Tlaxcala'}, + {id: 'VER', value: 'Veracruz'}, + {id: 'YUC', value: 'Yucatán'}, + {id: 'ZAC', value: 'Zacatecas'}, +] + + var controls_ine = [ {maxHeight: 15}, {cols: [{maxWidth: 15}, @@ -728,14 +779,23 @@ var controls_ine = [ {maxHeight: 10}, {cols: [{maxWidth: 15}, {view: 'richselect', id: 'lst_ine_tipo_comite', labelWidth: 150, - label: 'Tipo de Comite', options: opt_tipo_comite, - value: 'Ejecutivo Nacional'}, + label: 'Tipo de Comite', options: opt_tipo_comite, value: ''}, {}]}, {maxHeight: 10}, {cols: [{maxWidth: 15}, {view: 'text', id: 'txt_ine_idcontabilidad', name: 'ine_idcontabilidad', label: 'ID de Contabilidad: ', labelWidth: 150}, {}]}, + {maxHeight: 10}, + {cols: [{maxWidth: 15}, + {view: 'richselect', id: 'lst_ine_key_entidad', name: 'ine_key_entidad', + label: 'Clave Entidad: ', labelWidth: 150, options: opt_clave_entidad}, + {}]}, + {maxHeight: 10}, + {cols: [{maxWidth: 15}, + {view: 'richselect', id: 'lst_ine_ambito', name: 'ine_ambito', + label: 'Ámbito: ', labelWidth: 150, options: opt_ine_ambito}, + {}]}, ] diff --git a/source/templates/plantilla_factura.ods b/source/templates/plantilla_factura.ods index c5bd66f..421cf44 100644 Binary files a/source/templates/plantilla_factura.ods and b/source/templates/plantilla_factura.ods differ