Odoo Return Domain on onchange method many2many
Odoo Domain with Onchange
Probuse Admin
@api.onchange('project_test_ids')
def onchange_projecttest_ids(self):
domain = {}
if self.project_test_ids:
domain = {'test_id': '''[('id', 'in', %s)]'''%str(self.project_test_ids.ids)}
else:
test_ids = self.env['project.tests'].search([])
domain = {'test_id': '''[('id', 'in', %s)]'''%str(test_ids.ids)}
return {'domain': domain}