I override create method@api.model
def create(self, vals):
if vals.get('branch_id'):
fields_to_check = ['drawer_id', 'flexible_id', 'runner_id', 'group_1_id', 'group_2_id', 'group_3_id']
fields_to_check_in_vals = [vals.get(f) for f in fields_to_check]
if not any(fields_to_check_in_vals):
raise UserError('If branch is selected then you need to select one of the fields from data raport')
return super(ResPartner, self).create(vals)
it checks if branch_id is checked then 1 of the fields from fields_to_check should be seleced.
How can i do the same for write method. If some one selects branch_id fields then 1 of the fields from fields_to_check = ['drawer_id', 'flexible_id', 'runner_id', 'group_1_id', 'group_2_id', 'group_3_id'] should be selected to.