This question has been flagged
4 Replies
5003 Views

Here is my question:

find location where product_id = some_id and id is not 7 ?

the method below won't work

location = self.env['stock.quant'].search([('product_id','=',product_id.id),('location_id','!=',7)])

How should I do it ?

Thanx in advance ;)

Avatar
Discard

Use the SQL API!! :)

Author

Agree, but I would like to use Odoo API before I'll use SQL if possible of course :)

Best Answer

In search() method, the domain should be [[...]] and not [(...)]

in field declaration and xml the usage is reversed.

Avatar
Discard
Best Answer

I see the problem in the domain, use it like this [('product_id.id','=',product_id.id).....

Avatar
Discard