コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
716 ビュー

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

アバター
破棄
最善の回答

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:

アバター
破棄
関連投稿 返信 ビュー 活動
4
10月 16
31013
1
9月 15
3733
0
4月 15
539
2
4月 15
696
0
4月 15
524