Skip to main content

Utilities to make better use of OdooRPC

Project description


This module offers functions to:

  1. Instantiate common Odoo RPC libraries from a single .ini file that is compatible with all libraries (currently odooly and odoorpc);

  2. Run DEEP read and search_read queries, retrieving data from multiple models at once, in an efficient manner and using parallel execution of RPCs;

  3. These functions to support DEEP queries can also be used as a building block to support GraphQL or GraphQL-like querying.


  • Extend the utils package to support GraphQL queries;
  • Write an odoorpc_fast class to speed-up RPC queries by using HTTP sessions and gzip encoding;
  • Many, many potential functionalities... feel free to help writing and suggesting!


from odoorpc_utils import FastDeepQueries, OdooInstantiator

# read from file odoorpc_utils.ini, odoorpc-utils.ini or odooly.ini
# If you prefer you can skip this and instantiate odoorpc the old way.
odoo = OdooInstantiator.odoorpc_from_config_file('production')

# pass an instance of logged-in odoorpc here
fdq = FastDeepQueries(odoo)

# Let's get the id of 100 sales orders...
ids = fdq.query_fast(model_name='sale.order', limit=100)

# The fields you want to retrieve is specified in this easy to understand syntax...
fields = ['number,date_confirmed,order_total',
          'sale_order_line_ids.quantity, unit_price, total_price',

# Which is then parsed, relations are retrieved and a more complex structure of dicts is built
fields_deep = fdq.build_fields_deep_structure(model_name='sale.order', fields_deep=fields)

# Now let's make a deep query for 100 sales order and see how fast it is 
# Nope, it will not be blazing fast, it will actually be quite slow, but MUCH faster 
# than what you usually get from odoorpc...
res = fdq.query_deep(fields_deep, ids=ids, n_threads=8)

# Done!

# RPC is slow... each query takes at least 1 second, larger queries can take much longer. Running them in
# parallel speeds things up significantly (but it is still RPC)


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for odoorpc-utils, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size odoorpc_utils-0.1.3-py3-none-any.whl (13.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size odoorpc_utils-0.1.3.tar.gz (5.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page