I’m having a problem with returning the domain for the field when executing onchange method.
For the code below, it works fine on Odoo version 14. But on Odoo version 17, it doesn’t work.
service_id = fields.Many2one('ahamove.service', string='Service')
service_request_ids = fields.Many2many('ahamove.service.request', 'estimate_request_rel',
'choose_id', 'request_id', string='Request Type')
@api.onchange('service_id')
def _onchange_service_id(self):
for rec in self:
if rec.service_id:
return {'domain': {'service_request_ids': [('service_id', '=', rec.service_id.id)]}}
Can you guys give me a solution to do this?
I want the service_request_ids field to display only according to the selected service_id.