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

Hello I'm trying to compute a boolean field, I've tried many attemps like:


for record in self:

  if record.x_studio_photo_quant ==2:

    record[("x_studio_photo_check")]==bool(True)


or

for record in self:

  if record.x_studio_photo_quant ==2:

  a ==True

    record[("x_studio_photo_check")]=a


But they don't work, how can I fix this?

アバター
破棄
著作者 最善の回答

The problem was that 2 is not int but is a string,

So this worked:

for record in self:

  if record.x_studio_photo_quant =='2':

    a =bool(1)

    record[("x_studio_photo_check")]=a

or even simplier


for record in self:

  if record.x_studio_photo_quant =='2':

    record[("x_studio_photo_check")]=True

アバター
破棄
関連投稿 返信 ビュー 活動
1
4月 24
2534
1
2月 25
1304
4
1月 24
1859
2
8月 22
5189
1
10月 20
1996