forked from elmau/empresa-libre
commit
fd334eade4
|
@ -6103,28 +6103,33 @@ class CfdiNomina(BaseModel):
|
||||||
def _validate_incapacidades(self, row):
|
def _validate_incapacidades(self, row):
|
||||||
data = []
|
data = []
|
||||||
for i, key in enumerate(row[::3]):
|
for i, key in enumerate(row[::3]):
|
||||||
|
msg = ''
|
||||||
key = row[i * 3]
|
key = row[i * 3]
|
||||||
ti = SATTipoIncapacidad.get_by_key(key)
|
ti = SATTipoIncapacidad.get_by_key(key)
|
||||||
if ti is None:
|
if ti is None:
|
||||||
continue
|
msg = 'No se encontrón el tipo de incapacidad'
|
||||||
|
break
|
||||||
|
|
||||||
|
if isinstance(row[i * 3 + 1], str):
|
||||||
|
msg = 'Los dias de incapacidad debe ser un número'
|
||||||
|
break
|
||||||
|
if isinstance(row[i * 3 + 2], str):
|
||||||
|
msg = 'El importe de la incapacidad debe ser un número'
|
||||||
|
break
|
||||||
|
|
||||||
days = 0
|
|
||||||
if isinstance(row[i * 3 + 1], float):
|
|
||||||
days = int(row[i * 3 + 1])
|
days = int(row[i * 3 + 1])
|
||||||
importe = 0.0
|
|
||||||
if isinstance(row[i * 3 + 2], float):
|
|
||||||
importe = round(row[i * 3 + 2], DECIMALES)
|
importe = round(row[i * 3 + 2], DECIMALES)
|
||||||
if not days or not importe:
|
if not days or not importe:
|
||||||
continue
|
break
|
||||||
|
|
||||||
new = {
|
new = {
|
||||||
'dias': ti,
|
'dias': days,
|
||||||
'tipo': days,
|
'tipo': ti,
|
||||||
'importe': importe,
|
'importe': importe,
|
||||||
}
|
}
|
||||||
data.append(new)
|
data.append(new)
|
||||||
|
|
||||||
return data, ''
|
return data, msg
|
||||||
|
|
||||||
def _validate_exists(self, values):
|
def _validate_exists(self, values):
|
||||||
result = (CfdiNomina
|
result = (CfdiNomina
|
||||||
|
|
Loading…
Reference in New Issue