forked from elmau/empresa-libre
commit
77ff862400
|
@ -1368,6 +1368,7 @@ def _receptor(doc, version, values):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
data['usocfdi'] = values['usocfdi']
|
data['usocfdi'] = values['usocfdi']
|
||||||
|
data.update(values['receptor'])
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
|
|
||||||
from controllers import util
|
from controllers import util
|
||||||
from settings import log, VERSION, PATH_CP, COMPANIES, PRE, CURRENT_CFDI, \
|
from settings import log, DEBUG, VERSION, PATH_CP, COMPANIES, PRE, CURRENT_CFDI, \
|
||||||
INIT_VALUES, DEFAULT_PASSWORD, DECIMALES, IMPUESTOS, DEFAULT_SAT_PRODUCTO, \
|
INIT_VALUES, DEFAULT_PASSWORD, DECIMALES, IMPUESTOS, DEFAULT_SAT_PRODUCTO, \
|
||||||
CANCEL_SIGNATURE, PUBLIC, DEFAULT_SERIE_TICKET, CURRENT_CFDI_NOMINA, \
|
CANCEL_SIGNATURE, PUBLIC, DEFAULT_SERIE_TICKET, CURRENT_CFDI_NOMINA, \
|
||||||
DEFAULT_SAT_NOMINA, DECIMALES_TAX, TITLE_APP
|
DEFAULT_SAT_NOMINA, DECIMALES_TAX, TITLE_APP
|
||||||
|
@ -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 = {}
|
||||||
|
|
||||||
|
@ -3254,6 +3200,10 @@ class Facturas(BaseModel):
|
||||||
obj = SATTipoRelacion.get(SATTipoRelacion.key==invoice.tipo_relacion)
|
obj = SATTipoRelacion.get(SATTipoRelacion.key==invoice.tipo_relacion)
|
||||||
values['tiporelacion'] = str(obj)
|
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
|
||||||
return values
|
return values
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -5570,8 +5520,11 @@ class Empleados(BaseModel):
|
||||||
data = row.copy()
|
data = row.copy()
|
||||||
data['nombre_completo'] = '{} {} {}'.format(
|
data['nombre_completo'] = '{} {} {}'.format(
|
||||||
row['nombre'], row['paterno'], row['materno']).strip()
|
row['nombre'], row['paterno'], row['materno']).strip()
|
||||||
|
|
||||||
|
data['fecha_ingreso'] = None
|
||||||
if row['fecha_ingreso']:
|
if row['fecha_ingreso']:
|
||||||
data['fecha_ingreso'] = util.calc_to_date(row['fecha_ingreso'])
|
data['fecha_ingreso'] = util.calc_to_date(row['fecha_ingreso'])
|
||||||
|
|
||||||
data['tipo_contrato'] = SATTipoContrato.get_by_key(row['tipo_contrato'])
|
data['tipo_contrato'] = SATTipoContrato.get_by_key(row['tipo_contrato'])
|
||||||
data['es_sindicalizado'] = sn.get(row['es_sindicalizado'].lower(), False)
|
data['es_sindicalizado'] = sn.get(row['es_sindicalizado'].lower(), False)
|
||||||
data['tipo_jornada'] = SATTipoJornada.get_by_key(row['tipo_jornada'])
|
data['tipo_jornada'] = SATTipoJornada.get_by_key(row['tipo_jornada'])
|
||||||
|
@ -5593,8 +5546,8 @@ class Empleados(BaseModel):
|
||||||
en = 0
|
en = 0
|
||||||
ea = 0
|
ea = 0
|
||||||
for row in rows:
|
for row in rows:
|
||||||
# ~ if row['rfc'] == 'BASM740115RW0':
|
if not DEBUG and row['rfc'] == 'BASM740115RW0':
|
||||||
# ~ continue
|
continue
|
||||||
data = self._validate_import(self, row)
|
data = self._validate_import(self, row)
|
||||||
w = (Empleados.rfc==row['rfc'])
|
w = (Empleados.rfc==row['rfc'])
|
||||||
with database_proxy.transaction():
|
with database_proxy.transaction():
|
||||||
|
@ -6078,12 +6031,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 +6257,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,13 @@ function cmd_nomina_cancel_click(){
|
||||||
msg_error(msg)
|
msg_error(msg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Array.isArray(row)){
|
||||||
|
msg = 'Selecciona solo un registro'
|
||||||
|
msg_error(msg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if(row['estatus'] != 'Timbrado'){
|
if(row['estatus'] != 'Timbrado'){
|
||||||
msg = 'Solo se pueden cancelar recibos timbrados'
|
msg = 'Solo se pueden cancelar recibos timbrados'
|
||||||
msg_error(msg)
|
msg_error(msg)
|
||||||
|
|
Loading…
Reference in New Issue