Open the console (CTRL + SHIFT + I), and then get the broker object to the server model that you want to access (in this example, the "Leading"):
var Leads = new openerp.Model('crm.lead');
In openerp v7.0 you can get a broker like this:
var instance = openerp.instances.instance0 var Leads = new instance.web.Model('crm.lead')
After that, make your request, filter the results and indicate what you want to do with the list of objects (in this case, the counter):
Leads.query(['id']).all().then(function(leads){console.log(leads.length)})
in this case, shows the Id of the first:
Leads.query(['id']).first().then(function(lead){console.log(lead.id)})
More samples and documents for odoo:
https://www.odoo.com/documentation/8.0/reference/javascript.html#rpc
Additional examples and documents for openerp:
http://openerp-web-v7.readthedocs.org/en/latest/testing.html#rpc
yucer source share