class A(models.Model):
b_ids = fields.One2many('a', a_id);
@api.onchange('b_ids')
def set_all_other_value_to_false(self):
for b_id in self:
b_id.boolean_flag = False
#how can I set all other value to false, except the last one which I selected to True?
class B(models.Model):
boolean_flag = fields.Boolean(default=False)
a_id = fields.Many2One('a')
I don't know how I can set all boolean_flag to False except the last one which I selected. How can I solve that problem?