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'):
|
||||
rfc = data['emisor']['rfc']
|
||||
default = 'plantilla_factura.ods'
|
||||
if DEBUG:
|
||||
rfc = emisor_rfc
|
||||
|
||||
version = data['comprobante']['version']
|
||||
default = f'plantilla_factura_{version}.ods'
|
||||
|
||||
if 'nomina' in data and data['nomina']:
|
||||
default = 'plantilla_nomina.ods'
|
||||
|
@ -2227,11 +2227,27 @@ class UpFile(object):
|
|||
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):
|
||||
rfc = rfc.lower()
|
||||
tmp = file_obj.filename.split('.')
|
||||
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 = {
|
||||
'txt_plantilla_factura_32': EXT['ODS'],
|
||||
'txt_plantilla_factura_33': EXT['ODS'],
|
||||
|
|
|
@ -597,6 +597,7 @@ var type_make_pdf = [
|
|||
|
||||
|
||||
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'},
|
||||
]
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue