跳至内容
菜单
此问题已终结
2 回复
17060 查看

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.

 

 

形象
丢弃
相关帖文 回复 查看 活动
1
8月 24
1937
4
12月 20
11960
0
7月 17
3091
1
3月 15
4349
0
6月 19
3773