diff --git a/source/app/models/main.py b/source/app/models/main.py index 5fdb284..9e187b8 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -3169,60 +3169,6 @@ class Facturas(BaseModel): obj.save() return {'ok': True, 'msg': 'Notas guardadas correctamente'} - #~ Revisar - def _get_data_cfdi_to_pdf(self, xml, cancel, version): - pre_nomina = PRE['NOMINA'][version] - - data['nomina'] = {} - node = doc.find('{}Complemento/{}Nomina'.format(pre, pre_nomina)) - if not node is None: - data['nomina']['nomina'] = node.attrib.copy() - subnode = node.find('{}Emisor'.format(pre_nomina)) - if not subnode is None: - data['emisor'].update(subnode.attrib.copy()) - subnode = node.find('{}Receptor'.format(pre_nomina)) - data['receptor'].update(subnode.attrib.copy()) - - subnode = node.find('{}Percepciones'.format(pre_nomina)) - data['nomina']['percepciones'] = subnode.attrib.copy() - detalle = [] - for n in subnode.getchildren(): - if 'SeparacionIndemnizacion' in n.tag: - continue - detalle.append(n.attrib.copy()) - data['nomina']['percepciones']['detalle'] = detalle - - data['nomina']['deducciones'] = None - subnode = node.find('{}Deducciones'.format(pre_nomina)) - if not subnode is None: - data['nomina']['deducciones'] = subnode.attrib.copy() - detalle = [] - for n in subnode.getchildren(): - detalle.append(n.attrib.copy()) - data['nomina']['deducciones']['detalle'] = detalle - - data['nomina']['incapacidades'] = None - subnode = node.find('{}Incapacidades'.format(pre_nomina)) - if not subnode is None: - detalle = [] - for n in subnode.getchildren(): - detalle.append(n.attrib.copy()) - data['nomina']['incapacidades'] = detalle - - data['nomina']['otrospagos'] = None - subnode = node.find('{}OtrosPagos'.format(pre_nomina)) - if not subnode is None: - data['nomina']['otrospagos'] = subnode.attrib.copy() - detalle = [] - for n in subnode.getchildren(): - detalle.append(n.attrib.copy()) - ns = n.find('{}SubsidioAlEmpleo'.format(pre_nomina)) - if not ns is None: - data['nomina']['otrospagos']['SubsidioCausado'] = ns.attrib['SubsidioCausado'] - data['nomina']['otrospagos']['detalle'] = detalle - - return data - def _get_not_in_xml(self, invoice, emisor): values = {} @@ -6078,12 +6024,16 @@ class CfdiNomina(BaseModel): ) return {'ok': True, 'rows': tuple(rows)} - def _validate_timbrado(self, data): + def _validate_rules_nomina(self, data): receptor = data['receptor'] if receptor['TipoContrato'] == '99': del data['emisor']['RegistroPatronal'] - return data + # ~ NOM 154 + if data['nomina']['TipoNomina'] == 'E': + data['receptor']['PeriodicidadPago'] = '99' + + return def _make_xml(self, cfdi, auth): emisor = Emisor.select()[0] @@ -6300,7 +6250,7 @@ class CfdiNomina(BaseModel): 'otros_pagos': otros_pagos, 'incapacidades': incapacidades, } - nomina = self._validate_timbrado(self, nomina) + self._validate_rules_nomina(self, nomina) data = { 'comprobante': comprobante, diff --git a/source/static/js/controller/nomina.js b/source/static/js/controller/nomina.js index 4971a52..a80a3cb 100644 --- a/source/static/js/controller/nomina.js +++ b/source/static/js/controller/nomina.js @@ -432,6 +432,7 @@ function cmd_nomina_cancel_click(){ msg_error(msg) return } + if(Array.isArray(row)){ msg = 'Selecciona solo un registro' msg_error(msg)