Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
4513 Ansichten

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
Verwerfen
Autor Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Apr. 24
2584
1
Feb. 25
1349
4
Jan. 24
1898
2
Aug. 22
5244
1
Okt. 20
2036