Add template in json for 4.0

This commit is contained in:
el Mau 2023-02-01 22:26:10 -06:00
parent 76d5f51d78
commit 7a0fb2b243
3 changed files with 15 additions and 11 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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): ',