Odoo Help


How to get some data from database using API?

Dr Obx
on 3/3/16, 10:05 AM 646 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 ;)

Use the SQL API!! :)

Ray Carnes
on 3/3/16, 10:56 AM

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

Dr Obx
on 3/3/16, 10:57 AM
Thanh Loyal
On 3/4/16, 2:04 AM

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

in field declaration and xml the usage is reversed.

Samer Al-Sarhan
On 3/3/16, 6:10 PM

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/3/16, 10:05 AM
Seen: 646 times
Last updated: 3/4/16, 2:04 AM