Skip to Content
Menu
This question has been flagged
1 Atsakyti
4602 Rodiniai

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?

Portretas
Atmesti
Autorius 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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
1
bal. 24
2658
1
vas. 25
1524
4
saus. 24
1985
2
rugp. 22
5386
1
spal. 20
2108