Skip to Content
मेन्यू
This question has been flagged
1 Reply
4429 Views

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?

Avatar
Discard
Author Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
अप्रैल 24
2470
1
फ़र॰ 25
1277
4
जन॰ 24
1798
2
अग॰ 22
5139
1
अक्तू॰ 20
1965