Hello All,
I am trying to create dynamic domain to filter the values of many2one fields after call the onchange method:
XML View:
<field name="type" on_change="get_values(type)"/>
<field name="field1">
PY File:
'type':fields.selection([('1','1'),('2','2')],'name'),
'field1':fields.many2one('class','Name'),
And Method:
def get_values(self, cr, uid, ids,type,context={}):
res=[]
##here some code to filter values by search
##search values append into list
##like this where res store values like [1,2,3,4]
res.append(product_id[0])
return {
'domain': {
'field1': [('id', 'in', res)],
} }
This functionality is working in v6 but not in v7.
Welcome your suggestion
Thanks
This is not enough to diagnose the problem. Post your actual get_values() code or an example that replicates the problem.
Returning domain in onchange is working in v7 also. Make sure you are working with latest branch of v7.
please paste here your get_values function.need to get something from your code. :-)