Skip to Content
Menu
This question has been flagged
2 Replies
41822 Views

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
Discard
Best Answer

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
Discard
Author Best Answer

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
Discard
Related Posts Replies Views Activity
1
Mar 15
2682
2
Mar 15
5444
0
Mar 15
2814
3
May 24
3245
1
Dec 20
2088