Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
4430 Weergaven

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
Annuleer
Auteur Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
apr. 24
2471
1
feb. 25
1281
4
jan. 24
1803
2
aug. 22
5139
1
okt. 20
1965