Hi, my goal is to change a boolean field based on current selected company under 'sale.order'.
'sale.order' has field Many2one 'company_id' related to 'res.company'.
If the stored value in field 'company_id' is different than the one selected by current user, field value equals to False in UI before saving, if they are the same, the boolean field equals to True.
Below is what I've got, Any input is very welcome, thank you.
match = fields.Boolean('Match', compute='_check_company')
def _check_company(self):
current_company = lambda self: self.env['res.users']._get_company()
if self.company_id.name != current_company.name:
self.match = False
else:
self.match = True