Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
614 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
4
říj 16
30915
1
zář 15
3650
0
dub 15
471
2
dub 15
633
0
dub 15
441