From 7a0fb2b243ac63ac010b1b29b2dacbbfd5697ea8 Mon Sep 17 00:00:00 2001 From: el Mau Date: Wed, 1 Feb 2023 22:26:10 -0600 Subject: [PATCH] Add template in json for 4.0 --- source/app/controllers/util.py | 9 ++++++--- source/static/js/controller/partners.js | 2 +- source/static/js/ui/admin.js | 15 ++++++++------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py index ab69c10..28de848 100644 --- a/source/app/controllers/util.py +++ b/source/app/controllers/util.py @@ -1229,7 +1229,7 @@ class LIBO(object): pakings = data.pop('pakings', []) self._comprobante(data['comprobante']) - self._informacion_global(data['informacion_global']) + self._informacion_global(data.get('informacion_global', {})) self._emisor(data['emisor']) self._receptor(data['receptor']) self._conceptos(data['conceptos'], pakings) @@ -1607,6 +1607,7 @@ def to_pdf(data, emisor_rfc, ods=False, pdf_from='1'): def to_pdf_from_json(rfc, version, data): rfc = rfc.lower() name = '{}_{}.json'.format(rfc, version) + print('name', name) custom_styles = get_custom_styles(name) path_logo = _join(PATHS['LOGOS'], f"{rfc}.png") @@ -2295,12 +2296,14 @@ def upload_file(rfc, opt, file_obj): ext = tmp[-1].lower() versions = ('_3.2.ods', - '_3.3.ods', '_3.3_cn_1.2.ods', '_3.3_ccp_2.0.ods', + '_3.3.ods', '_3.3_cn_1.2.ods', '_3.3_ccp_2.0.ods', '_3.3.json', '_4.0.ods', '_4.0_cn_1.2.ods', '_4.0_cp_2.0.ods', '_4.0_ccp_2.0.ods', - '_4.0_cd_1.1.ods') + '_4.0_cd_1.1.ods', + '_4.0.json', + ) if opt in versions: return save_template(rfc, opt, file_obj) diff --git a/source/static/js/controller/partners.js b/source/static/js/controller/partners.js index 6286a13..ff21d32 100644 --- a/source/static/js/controller/partners.js +++ b/source/static/js/controller/partners.js @@ -399,7 +399,7 @@ function opt_tipo_change(new_value, old_value){ }else if (new_value == 2){ query = table_usocfdi.chain().find({moral: true}).data() }else{ - query = [{id: 'S01', value: 'Sin efectos fiscales. '}] + query = [{id: 'S01', value: '[S01] Sin efectos fiscales. '}] } $$('lst_uso_cfdi_socio').getList().parse(query) $$('lst_uso_cfdi_socio').refresh() diff --git a/source/static/js/ui/admin.js b/source/static/js/ui/admin.js index c631e5b..0d63234 100644 --- a/source/static/js/ui/admin.js +++ b/source/static/js/ui/admin.js @@ -603,10 +603,12 @@ var opt_templates_cfdi = [ {id: '_4.0_cp_2.0.ods', value: 'CFDI v4.0 - Pagos v2.0'}, {id: '_4.0_ccp_2.0.ods', value: 'CFDI v4.0 - Carta Porte v2.0'}, {id: '_4.0_cd_1.1.ods', value: 'CFDI v4.0 - Donativos v1.1'}, + {id: '_4.0.json', value: 'CFDI v4.0 - JSON'}, {id: '_3.3.ods', value: 'CFDI v3.3'}, {id: '_3.3_cn_1.2.ods', value: 'CFDI v3.3 - NĂ³mina v1.2'}, {id: '_3.3_ccp_2.0.ods', value: 'CFDI v3.3 - Carta Porte v2.0'}, {id: '_3.3_cp_1.0.ods', value: 'CFDI v3.3 - Pagos v1.0'}, + {id: '_3.3.json', value: 'CFDI v3.3 - JSON'}, {id: '_3.2.ods', value: 'CFDI v3.2'}, ] @@ -627,14 +629,13 @@ var options_templates = [ {view: 'search', id: 'txt_plantilla_factura_css', name: 'plantilla_factura_css', label: 'Archivo de estilos (CSS): ', labelPosition: 'top', icon: 'file'}, {maxWidth: 20} ]}, - - {maxHeight: 20}, - {cols: [{maxWidth: 20}, - {view: 'search', id: 'txt_plantilla_factura_json', name: 'plantilla_factura_json', - label: 'Plantilla Factura v3.3 (JSON): ', labelPosition: 'top', - icon: 'file'}, {maxWidth: 25}, - {}, {maxWidth: 20} ]}, {maxHeight: 20}, + //~ {cols: [{maxWidth: 20}, + //~ {view: 'search', id: 'txt_plantilla_factura_json', name: 'plantilla_factura_json', + //~ label: 'Plantilla Factura v3.3 (JSON): ', labelPosition: 'top', + //~ icon: 'file'}, {maxWidth: 25}, + //~ {}, {maxWidth: 20} ]}, + //~ {maxHeight: 20}, //~ {cols: [{maxWidth: 20}, //~ {view: 'search', id: 'txt_plantilla_pagos10', name: 'plantilla_pagos10', //~ label: 'Plantilla Factura de Pagos v1.0 - Cfdi 3.3 (ODS): ',