I am trying to pass a list of order_ids to .filtered so as to exclude them from my recordset but I seem to be getting an error global name "order_ids" is not defined. Below is an example of my code.
active_ids = ['34','35',36']
p = self.env['stock.pack.operation']
p_obj = p.search([['id','in',active_ids]])
order_ids = ['1','2','3']
p_obj.filtered(lambda r: r.origin_id.id IN order_ids)
Search for specific ids makes no sense(at least that you want to make sure that an id really exists), use a direct browse to that like:
or you could directly search for that using the proper domain, because
p_obj = self.env['stock.pack.operation'].search([('id', 'in, [34,35,36]), ('origin_id.id', 'in', [1,2,3]))
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 11/11/16, 6:41 PM|
|Seen: 199 times|
|Last updated: 11/12/16, 6:10 PM|