Community mailing list archives

Re: Domain for Many2one on onchange

Numa Extreme Systems, Gustavo Marino
- 06/04/2016 17:43:33
And if you want to limit to a list of ids,  the domain should be like {'vehicle_rq': [('id', 'in', vehicle_models)]}

Gustavo Adrian Marino


Mobile:  +54 911 5498 2515


Skype: gustavo.adrian.marino


Descripción: Numa Logo V 1-0

2016-06-04 10:57 GMT-03:00 Pedro Manuel Baeza Romero <>:

Don't put, but @api.multi, because the return value is enclosed in a list, and thus, not parsed.


El 04/06/2016 14:47, "MD Tanzilul Hasan Khan" <> escribió:
Hello Community,

I am trying to filter values for a Many2one field on onchange function. But it isn't working. 

My goal is to filter vehicle on a given date. I am getting values from the ORM. Like after searching I am getting 13 in the vehicle_models list. But the domain isn't working.

I have tried various ways by searching in odoo forum and stack overflow. There is no problem with my values but the Domain isn't working. Can anyone please help me with this or let me know what I am missing? My onchange code is below -
@api.onchange('req_from', 'req_to')
def vehicle_filter(self):
fleet_req_obj = self.env['fleet.requisition']
requisition_search =[['req_from','<=',self.req_from],['req_to','>=',self.req_to]])
vehicle_models = []
for i in requisition_search:

res = {}
if vehicle_models:
res['domain'] = {'vehicle_rq': [('id', '=', vehicle_models)]}
return res

MD. Tanzilul Hasan Khan.

Post to:

Post to: