Fix - Issue #165
This commit is contained in:
parent
2272a4b6c7
commit
1f40c42ba0
|
@ -3169,60 +3169,6 @@ class Facturas(BaseModel):
|
||||||
obj.save()
|
obj.save()
|
||||||
return {'ok': True, 'msg': 'Notas guardadas correctamente'}
|
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):
|
def _get_not_in_xml(self, invoice, emisor):
|
||||||
values = {}
|
values = {}
|
||||||
|
|
||||||
|
@ -6078,12 +6024,16 @@ class CfdiNomina(BaseModel):
|
||||||
)
|
)
|
||||||
return {'ok': True, 'rows': tuple(rows)}
|
return {'ok': True, 'rows': tuple(rows)}
|
||||||
|
|
||||||
def _validate_timbrado(self, data):
|
def _validate_rules_nomina(self, data):
|
||||||
receptor = data['receptor']
|
receptor = data['receptor']
|
||||||
if receptor['TipoContrato'] == '99':
|
if receptor['TipoContrato'] == '99':
|
||||||
del data['emisor']['RegistroPatronal']
|
del data['emisor']['RegistroPatronal']
|
||||||
|
|
||||||
return data
|
# ~ NOM 154
|
||||||
|
if data['nomina']['TipoNomina'] == 'E':
|
||||||
|
data['receptor']['PeriodicidadPago'] = '99'
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
def _make_xml(self, cfdi, auth):
|
def _make_xml(self, cfdi, auth):
|
||||||
emisor = Emisor.select()[0]
|
emisor = Emisor.select()[0]
|
||||||
|
@ -6300,7 +6250,7 @@ class CfdiNomina(BaseModel):
|
||||||
'otros_pagos': otros_pagos,
|
'otros_pagos': otros_pagos,
|
||||||
'incapacidades': incapacidades,
|
'incapacidades': incapacidades,
|
||||||
}
|
}
|
||||||
nomina = self._validate_timbrado(self, nomina)
|
self._validate_rules_nomina(self, nomina)
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'comprobante': comprobante,
|
'comprobante': comprobante,
|
||||||
|
|
|
@ -432,6 +432,7 @@ function cmd_nomina_cancel_click(){
|
||||||
msg_error(msg)
|
msg_error(msg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Array.isArray(row)){
|
if(Array.isArray(row)){
|
||||||
msg = 'Selecciona solo un registro'
|
msg = 'Selecciona solo un registro'
|
||||||
msg_error(msg)
|
msg_error(msg)
|
||||||
|
|
Loading…
Reference in New Issue