forked from elmau/empresa-libre
Add template for CFDI 4.0
This commit is contained in:
parent
f766f92618
commit
1a507d2eeb
|
@ -1554,11 +1554,11 @@ class LIBO(object):
|
||||||
|
|
||||||
def to_pdf(data, emisor_rfc, ods=False, pdf_from='1'):
|
def to_pdf(data, emisor_rfc, ods=False, pdf_from='1'):
|
||||||
rfc = data['emisor']['rfc']
|
rfc = data['emisor']['rfc']
|
||||||
default = 'plantilla_factura.ods'
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
rfc = emisor_rfc
|
rfc = emisor_rfc
|
||||||
|
|
||||||
version = data['comprobante']['version']
|
version = data['comprobante']['version']
|
||||||
|
default = f'plantilla_factura_{version}.ods'
|
||||||
|
|
||||||
if 'nomina' in data and data['nomina']:
|
if 'nomina' in data and data['nomina']:
|
||||||
default = 'plantilla_nomina.ods'
|
default = 'plantilla_nomina.ods'
|
||||||
|
@ -2227,11 +2227,27 @@ class UpFile(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def save_template(rfc, opt, file_obj):
|
||||||
|
result = {'status': 'error', 'ok': False}
|
||||||
|
|
||||||
|
name_template = f'{rfc}{opt}'
|
||||||
|
path_template = _join(PATH_MEDIA, 'templates', name_template)
|
||||||
|
|
||||||
|
if save_file(path_template, file_obj.file.read()):
|
||||||
|
result = {'status': 'server', 'name': file_obj.filename, 'ok': True}
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def upload_file(rfc, opt, file_obj):
|
def upload_file(rfc, opt, file_obj):
|
||||||
rfc = rfc.lower()
|
rfc = rfc.lower()
|
||||||
tmp = file_obj.filename.split('.')
|
tmp = file_obj.filename.split('.')
|
||||||
ext = tmp[-1].lower()
|
ext = tmp[-1].lower()
|
||||||
|
|
||||||
|
versions = ('_3.3.ods', '_3.3_cp_2.0.ods', '_4.0.ods')
|
||||||
|
if opt in versions:
|
||||||
|
return save_template(rfc, opt, file_obj)
|
||||||
|
|
||||||
EXTENSIONS = {
|
EXTENSIONS = {
|
||||||
'txt_plantilla_factura_32': EXT['ODS'],
|
'txt_plantilla_factura_32': EXT['ODS'],
|
||||||
'txt_plantilla_factura_33': EXT['ODS'],
|
'txt_plantilla_factura_33': EXT['ODS'],
|
||||||
|
|
|
@ -597,6 +597,7 @@ var type_make_pdf = [
|
||||||
|
|
||||||
|
|
||||||
var opt_templates_cfdi = [
|
var opt_templates_cfdi = [
|
||||||
|
{id: '_4.0.ods', value: 'CFDI v4.0'},
|
||||||
{id: '_3.3_cp_2.0.ods', value: 'CFDI v3.3 - Carta Porte 2.0'},
|
{id: '_3.3_cp_2.0.ods', value: 'CFDI v3.3 - Carta Porte 2.0'},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue