How to use search_count method  in Odoo | XML RPC | Odoo External API – CBMS Odoo ERP

How to use search_count method in Odoo | XML RPC | Odoo External API – CBMS Odoo ERP

0 minutes, 35 seconds Read

Rather than retrieve a possibly gigantic list of records and count them, search_count() can be used to retrieve only the number of records matching the query. It takes the same domain filter as search() and no other parameter.

url = ”
db = ‘test_local_enterprise_db’
username = ’14’
password = ’14’
import xmlrpc.client
common = xmlrpc.client.ServerProxy(‘{}/xmlrpc/2/common’.format(url))
version = common.version()
print(“version”, version)
uid = common.authenticate(db, username, password, {})
print(“uid = “,uid)
models = xmlrpc.client.ServerProxy(‘{}/xmlrpc/2/object’.format(url))
company_count = models.execute_kw(db, uid, password,’res.partner’, ‘search_count’,[[[‘is_company’, ‘=’, True]]])
print(“company_count”,company_count)

#search_count #method #Odoo #XML #RPC #Odoo #External #API

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *