Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
16841 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

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)

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 24
1453
4
pro 20
11693
0
čvc 17
2912
1
bře 15
4170
0
čvn 19
3650