İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
43782 Görünümler

I have installed the Community edition of Odoo 11 and am trying to retrieve data through xml-rpc. 

How do I know which objects are available through the api, and which query parameters and their types are available for each object?

In particular I am trying to retrieve all products, and products filtered by category.

the following code

odoo.execute_kw('res.product', 'search', params, function (err, value) {
    if (err) { return console.log(err); }    console.log('Result: ', value);});

returns 

'Object res.product doesn\'t exist' 

 

Avatar
Vazgeç
En İyi Yanıt

Hi,

Seems you have given wrong model name, there is no table named res.product by default in odoo, the table name for the Products is product.product.

Sample,

models.execute_kw(db, uid, password,
    'res.partner', 'search_read',
    [[['is_company', '=', True], ['customer', '=', True]]],
    {'fields': ['name', 'country_id', 'comment'], 'limit': 5})

Above given is a sample of reading the data from res.partner table based on some search condition.


You can go through this odoo documentation, explaining the same in detail :-  https://www.odoo.com/documentation/11.0/webservices/odoo.html

Thanks

Avatar
Vazgeç
Üretici En İyi Yanıt

For those interested/having the same question:

The model (or objects) correspond to the database table names. 

There doesn't seem to be any abstraction/controller logic provided by the xml/rpc layer.

You can view the table name and table fields in the UI by activating the debug mode (add ?debug=1 to the url),

and select view fields from the debug menu.  

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Şub 25
18
2
Mar 15
6408
0
Mar 15
3503
1
Mar 15
3361
3
May 24
4728