Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
628 Vistas

Please who can help me.

I have this function:

  def compute_n_1_info(self,cr,uid,payslip,context=None):
if tools['int'](payslip.date_from[5:7])==1:
value = {'assiette_irpp_anuel_reel_n_1': 0.0,
'irpp_reel_n_1': 0.0,
'cumul_brut_imp_reel_n_1': 0.0,
'cumul_retenue_source_n_1': 0.0,
}
else:
value = {'assiette_irpp_anuel_reel_n_1': 1,
'irpp_reel_n_1': 1,
'cumul_brut_imp_reel_n_1': 1,
'cumul_retenue_source_n_1': 1,
}

but i got an error (

   if tools['int'](payslip.date_from[5:7])==1:
TypeError: 'module' object has no attribute '__getitem__'

) and i didnt know how to resolve it. please help

Avatar
Descartar
Mejor respuesta

if payslip and payslip.date_from and isinstance(payslip.date_from[5:7], int)  == 1:

perhaps :

from openert import tools

......

if payslip and payslip.date_from and tools['int'](payslip.date_from[5:7])==1:

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
4
oct 16
30941
1
sept 15
3660
0
abr 15
482
2
abr 15
651
0
abr 15
448