Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
43339 มุมมอง

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' 

 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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.  

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.พ. 25
18
2
มี.ค. 15
6045
0
มี.ค. 15
3285
1
มี.ค. 15
3159
3
พ.ค. 24
4327