Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
4499 Prikazi

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
Opusti
Avtor 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
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
apr. 24
2578
1
feb. 25
1336
4
jan. 24
1891
2
avg. 22
5227
1
okt. 20
2028