Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
44192 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Penulis Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
0
Feb 25
18
2
Mar 15
6630
0
Mar 15
3675
1
Mar 15
3538
3
Mei 24
5071