Hello there,
I'm trying to create a domain on a Many2many field:
@api.onchange('name')
def onchange_domain_on_days(self):
res = {}
ids = []
employee_model = self.env['hr.employee']
all_employees = employee_model.search([])
for employee in all_employees:
if employee.user_id.store_id == self.working_hours_id.store_id:
ids.append(employee.id)
res['domain'] = {
'monday': [('id', 'in', ids)],
}
return res
This will work very well! BUT only if the field value 'name' changes.. Is there a way to apply this from the beginning?
Best regards
--
Alejandro