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

Hi, I search how to interact with openerp database in javascript. I've found this example on the API documentation but it's don't works.

    var Users = new openerp.web.Model('res.users');
    Users.query(['name', 'login', 'user_email', 'signature'])
         .filter([['active', '=', true], ['company_id', '=', main_company]])
         .limit(15)
         .all().then(function (users) {
        // do work with users records
        alert(users)
    });

The error:

Object [object Object] has no method 'query'

Do you know why?

Thanks in advance for your help.

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

Where you coding their should be 'openerp' as function parameter in top line of file. or 'instance' as parameter

new openerp.web.Model('res.users');

or new instance.web.Model('res.users');

So which once used try that one.  I double check and its working.

 

 

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

You should take a look at this :

http://thierry-godin.developpez.com/openerp/openerp-module-pos-enhanced-fr/

and this :  http://thierry-godin.developpez.com/openerp/tutoriel-openerp-realisation-module-web-pour-point-vente/

You may find examples here (english version available)

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 24
1573
Change context from within controller แก้ไขแล้ว
4
ธ.ค. 20
11751
0
ก.ค. 17
2973
1
มี.ค. 15
4209
0
มิ.ย. 19
3673