Fix get data foro version 3.3

This commit is contained in:
Mauricio Baeza 2022-05-31 22:14:17 -05:00
parent ae259e461b
commit bc0cd9f3e1
5 changed files with 9 additions and 22 deletions

View File

@ -2245,7 +2245,7 @@ def upload_file(rfc, opt, file_obj):
tmp = file_obj.filename.split('.')
ext = tmp[-1].lower()
versions = ('_3.3.ods', '_3.3_cp_2.0.ods', '_4.0.ods')
versions = ('_3.2.ods', '_3.3.ods', '_3.3_cp_2.0.ods', '_4.0.ods')
if opt in versions:
return save_template(rfc, opt, file_obj)

View File

@ -357,6 +357,7 @@ class CfdiToDict(object):
}
def __init__(self, xml):
self.version = ''
self._values = {
'leyendas': (),
}
@ -368,8 +369,8 @@ class CfdiToDict(object):
return self._values
def _get_values(self):
version = self._root.attrib['Version']
ns = f'cfdi{version}'
self.version = self._root.attrib['Version']
ns = f'cfdi{self.version}'
self.NS['cfdi'] = self.NS_VERSION[ns]
self._receptor()
@ -380,9 +381,10 @@ class CfdiToDict(object):
path = '//cfdi:Receptor'
receptor = self._root.xpath(path, namespaces=self.NS)[0]
attr = CaseInsensitiveDict(receptor.attrib)
attr['domiciliofiscal'] = attr['DomicilioFiscalReceptor']
attr['regimenfiscal'] = self.REGIMEN_FISCAL[attr['RegimenFiscalReceptor']]
attr['usocfdi'] = self.USO_CFDI[attr['UsoCFDI']]
if self.version == '4.0':
attr['domiciliofiscal'] = attr['DomicilioFiscalReceptor']
attr['regimenfiscal'] = self.REGIMEN_FISCAL[attr['RegimenFiscalReceptor']]
self._values['receptor'] = attr
return

View File

@ -692,8 +692,6 @@ class Configuracion(BaseModel):
)
elif keys['fields'] == 'templates':
fields = (
'txt_plantilla_factura_32',
'txt_plantilla_factura_33',
'txt_plantilla_factura_html',
'txt_plantilla_factura_css',
'txt_plantilla_factura_json',
@ -4722,11 +4720,6 @@ class Facturas(BaseModel):
obj = SATTipoRelacion.get(SATTipoRelacion.key==invoice.tipo_relacion)
values['tiporelacion'] = str(obj)
# ~ receptor = Socios.select().where(Socios.id==invoice.cliente.id).dicts()[0]
# ~ values['receptor'] = {}
# ~ for k, v in receptor.items():
# ~ values['receptor'][k] = v
# ~ use_packing = Configuracion.get_bool('chk_use_packing')
# ~ if use_packing:
# ~ w = FacturasDetalle.factura == invoice

View File

@ -76,8 +76,6 @@ var controllers = {
//~ Opciones
tb_options = $$('tab_options').getTabbar()
tb_options.attachEvent('onChange', tab_options_change)
$$('txt_plantilla_factura_32').attachEvent('onItemClick', txt_plantilla_factura_32_click)
$$('txt_plantilla_factura_33').attachEvent('onItemClick', txt_plantilla_factura_33_click)
$$('txt_plantilla_factura_html').attachEvent('onItemClick', txt_plantilla_factura_html_click)
$$('txt_plantilla_factura_json').attachEvent('onItemClick', txt_plantilla_factura_json_click)
$$('txt_plantilla_factura_css').attachEvent('onItemClick', txt_plantilla_factura_css_click)

View File

@ -598,7 +598,9 @@ var type_make_pdf = [
var opt_templates_cfdi = [
{id: '_4.0.ods', value: 'CFDI v4.0'},
{id: '_3.3.ods', value: 'CFDI v3.3'},
{id: '_3.3_cp_2.0.ods', value: 'CFDI v3.3 - Carta Porte 2.0'},
{id: '_3.2.ods', value: 'CFDI v3.2'},
]
@ -611,14 +613,6 @@ var options_templates = [
{},
{maxWidth: 20} ]},
{maxHeight: 50},
{cols: [{maxWidth: 20},
{view: 'search', id: 'txt_plantilla_factura_32', name: 'plantilla_factura_32',
label: 'Plantilla Factura v3.2 (ODS): ', labelPosition: 'top',
icon: 'file'}, {maxWidth: 25},
{view: 'search', id: 'txt_plantilla_factura_33', labelPosition: 'top',
label: 'Plantilla Factura v3.3 (ODS): ', icon: 'file'},
{maxWidth: 20} ]},
{maxHeight: 20},
{cols: [{maxWidth: 20},
{view: 'search', id: 'txt_plantilla_factura_html', name: 'plantilla_factura_html',
label: 'Plantilla Factura v3.3 (HTML): ', labelPosition: 'top',