diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py index 0aadfc8..9dbcca7 100644 --- a/source/app/controllers/util.py +++ b/source/app/controllers/util.py @@ -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) diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index 2c64b4d..985a0a9 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -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 diff --git a/source/app/models/main.py b/source/app/models/main.py index e661be7..ff4fe6d 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -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 diff --git a/source/static/js/controller/admin.js b/source/static/js/controller/admin.js index 0016d98..c81a63f 100644 --- a/source/static/js/controller/admin.js +++ b/source/static/js/controller/admin.js @@ -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) diff --git a/source/static/js/ui/admin.js b/source/static/js/ui/admin.js index b9e197d..0362aa9 100644 --- a/source/static/js/ui/admin.js +++ b/source/static/js/ui/admin.js @@ -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',