Merge branch 'develop'

Fix - Issue #189
This commit is contained in:
Mauricio Baeza 2018-02-16 14:55:54 -06:00
commit fd334eade4
1 changed files with 16 additions and 11 deletions

View File

@ -6103,28 +6103,33 @@ class CfdiNomina(BaseModel):
def _validate_incapacidades(self, row):
data = []
for i, key in enumerate(row[::3]):
msg = ''
key = row[i * 3]
ti = SATTipoIncapacidad.get_by_key(key)
if ti is None:
continue
msg = 'No se encontrón el tipo de incapacidad'
break
days = 0
if isinstance(row[i * 3 + 1], float):
days = int(row[i * 3 + 1])
importe = 0.0
if isinstance(row[i * 3 + 2], float):
importe = round(row[i * 3 + 2], DECIMALES)
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 = int(row[i * 3 + 1])
importe = round(row[i * 3 + 2], DECIMALES)
if not days or not importe:
continue
break
new = {
'dias': ti,
'tipo': days,
'dias': days,
'tipo': ti,
'importe': importe,
}
data.append(new)
return data, ''
return data, msg
def _validate_exists(self, values):
result = (CfdiNomina