Hi, I am trying to add dynamic domain in Odoo 10 Many2one field. Here is the code:
@api.multi
def _get_education_domain(self):
res = {}
education_list = []
if self.emeu_sector_id.id:
education_ids = self.emeu_sector_id.emeu_education_ids
education_list = [x.id for x in education_ids]
return [('id', 'in', education_list)]
emeu_education_id = fields.Many2one(
'emeu.education', string=_('Education'), ondelete='restrict', domain=_get_education_domain)
This throws JSON serialiser error. Can anyone please help me to fix the issue.