Skip to Content
Menú
This question has been flagged
2 Respostes
17013 Vistes

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.

Avatar
Descartar
Best Answer

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.

 

 

Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
d’ag. 24
1817
4
de des. 20
11907
0
de jul. 17
3049
1
de març 15
4301
0
de juny 19
3754