This section gives the bare minimum to use Odooly as a command line tool or within an interactive shell.


Download and install the latest release from PyPI:

pip install -U odooly

Command line arguments

There are few arguments to query Odoo models from the command line. Although it is quite limited:

$ odooly --help

Usage: [options] [search_term_or_id [search_term_or_id ...]]

Inspect data on Odoo objects.  Use interactively or query a model (-m) and
pass search terms or ids as positional parameters after the options.

  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -l, --list            list sections of the configuration
  --env=ENV             read connection settings from the given section
  -c CONFIG, --config=CONFIG
                        specify alternate config file (default: 'odooly.ini')
  --server=SERVER       full URL of the server (default:
  -d DB, --db=DB        database
  -u USER, --user=USER  username
  -p PASSWORD, --password=PASSWORD
                        password, or it will be requested on login
  -m MODEL, --model=MODEL
                        the type of object to find
  -f FIELDS, --fields=FIELDS
                        restrict the output to certain fields (multiple
  -i, --interact        use interactively; default when no model is queried
  -v, --verbose         verbose
$ #


$ odooly -d demo -m res.partner -f name -f lang 1
"Your Company","en_US"
$ odooly -d demo -m res.groups -f full_name 'id > 0'
"Administration / Access Rights"
"Administration / Configuration"
"Human Resources / Employee"
"Usability / Multi Companies"
"Usability / Extended View"
"Usability / Technical Features"
"Sales Management / User"
"Sales Management / Manager"
"Partner Manager"

Interactive use

Edit odooly.ini and declare the environment(s):

scheme = http
host = localhost
port = 8069
database = odoo
username = admin

username = demo
password = demo
protocol = xmlrpc

username = demo
password = demo
protocol = jsonrpc

scheme = local
options = -c /path/to/odoo-server.conf --without-demo all

Connect to the Odoo server:

odooly --list
odooly --env demo

This is a sample session:

>>> env['res.users']
<Model 'res.users'>
>>> env['res.users'].search_count()
>>> crons = env['ir.cron'].with_context(active_test=False).search([])
>>>'active name')
[{'active': True, 'id': 5, 'name': 'Calendar: Event Reminder'},
 {'active': False, 'id': 4, 'name': 'Mail: Fetchmail Service'}]
>>> #
>>> env.modules('delivery')
{'uninstalled': ['delivery', 'website_sale_delivery']}
>>> env.upgrade('base')
1 module(s) selected
42 module(s) to process:
  to upgrade    account
  to upgrade    account_chart
  to upgrade    account_tax_include
  to upgrade    base
>>> #


Use the --verbose switch to see what happens behind the scene. Lines are truncated at 79 chars. Use -vv or -vvv to print more.


To preserve the history of commands when closing the session, first create an empty file in your home directory: touch ~/.odooly_history

More details in the Tutorial section.