High Level API: Calling in Odoo HowTo Model

I am following the documentation and there is the following snippet on how to make a request in Odoo v 8.0

var Users = new openerp.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
});

      

But when I execute this code (with the sample company) I get the error every time:

TypeError: Users.query is not a function

Can anyone explain to me why and how to make a request in js with odoo?

+3


source to share


1 answer


query () is a shortcut to a builder-style interface for searching (search + read in Odoo RPC terms). It returns a Query () object, which is immutable, but allows new instances of Query () to be created from the first by adding new properties or modifying the parent object.



so you can use search () or read () instead of query ().

0


source







All Articles