Community mailing list archives

Re: Domain for Many2one on onchange

Pedro M. Baeza
- 06/04/2016 09:54:07

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: