Odoo Help

Welcome!

This community 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.

0

How to get some data from database using API?

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

Bista Solutions US, 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
0
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.

0
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).....

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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