Developer’s notes

Source code

Third-party integration

This module can be used with other Python libraries to achieve more complex tasks.

For example:

  • write unit tests using the standard unittest framework.

  • write BDD tests using the Gherkin language, and a library like Behave.

  • build an interface for Odoo, using a framework like Flask (HTML, JSON, SOAP, …).

Changes

2.6.5 (2026-04-12)

  • Use CSI x1b[ for colors, which is more universal than x9b.

  • Handle signal SIGWINCH to adjust width of output printing. Replace cols with Printer.width to match output’s width.

2.6.4 (2026-03-26)

  • Remove self from vars available in interactive mode. It was giving wrong suggestions in case of typing error.

  • Inject clear command in built-ins for Python <= 3.12.

  • Adjust call_kw path to /web/dataset/call_kw/<model>/<method for adequate HTTP logging, and to be consistent with Odoo Web.

2.6.3 (2026-03-18)

  • Improve output coloring. Do not color Python keywords and built-ins.

2.6.2 (2026-03-17)

  • Fix command-line parsing.

2.6.1 (2026-03-17)

  • Fix invocation like odooly https://demo.odoo.com.

2.6.0 (2026-03-17)

  • Colorize interactive console with Python 3.13+.

  • Switch to argparse for colored command line parser.

  • Backport output coloring for Python <= 3.13. Use environment variable FORCE_COLOR=1 to enable it.

  • Display error when identity check is not successful.

  • Add method Env.sql() to execute SQL queries as an administrator.

  • Drop support for Python 3.6 and 3.7.

  • Drop support for OpenERP and for Odoo 8.

  • Drop support for XML-RPC protocol. Use JSON-2 or JSON-RPC.

  • Remove db Service. Use Client.database WebAPI instead.

  • Remove report Service and workflow helpers. It was for Odoo <= 10.

  • Remove option for CSV output.

  • Remove %(...) formatting for RecordList.read(). Use {...} instead.

2.5.8 (2026-03-11)

  • Change dir(...) of Record and RecordList to avoid extra API calls on readline completion.

  • Json2: print details for internal server error 500.

  • Print API protocol on login: JSON-2, Web API, JSON-RPC, …

2.5.7 (2026-03-06)

  • Support Odoo saas-19.1. RPC service Client.db is removed.

  • Fix Env caching when API switches to JSON-2.

2.5.6 (2026-02-26)

  • Fix error handling.

  • Fix module upgrade.

  • Fix Env caching when switching between databases.

  • Clear API key when re-authenticating with password.

  • In case of Client.connect() error, list known configurations.

  • Optional argument database for Client.connect().

  • Improve performance of Model.search() when a single record is retrieved.

  • Preserve context for lazy RecordList evaluation.

2.5.5 (2026-02-10)

  • Fix Env.refresh() to preserve base methods.

  • Hide password when verbose is enabled.

  • Improve error display.

2.5.4 (2026-02-09)

  • Fix XML-RPC methods.

2.5.3 (2026-02-09)

  • Odoo 19 and beyond: add documentation when using Web API or Json2 API. Stored on Model._doc attribute.

  • Odoo 19 and beyond: list methods and arguments with Model._methods() or RecordList._methods().

  • Support HTTP Basic Authentication in URL, for example odooly https://user:password@odoo.example.net/.

  • Json2: internal refactoring, to detect "ids" argument.

  • Json2: fix arguments of Record.copy().

  • Support Python 3.15.

2.5.2 (2026-01-06)

  • Json2: performance improvement. Parameters of standard public methods are predefined.

  • Json2: improve error handling, catch HTTP status 401, 403 and 404.

  • Json2: set Accept: application/json HTTP header.

  • Fix login with __system__ user. Note: it is not supported, and disabled during Odoo installation, for safety reason. Use Env.sudo() or Model.sudo() instead.

2.5.1 (2025-11-11)

  • Fix Json2 API.

2.5.0 (2025-11-11)

  • Simplify signature of Model.search(): arguments order, limit and offset become keyword-only, and undocumented argument reverse is abandoned.

  • New: Model.search() returns a RecordList which is lazily evaluated. API method is called only when needed: if attributes are read or methods are called. It will use search_read API method when it’s adequate.

  • New: extracting a part of a lazy RecordList will not call API method, for simple use cases like env['account.move'].search([])[10:90]. It will set offset and limit on the prepared search instead.

  • Remove undocumented Env._web().

  • Refactor code for read field formatter.

  • Refactor Record and RecordList constructors: get rid of __new__ and simplify.

  • Add private method Record._invalidate_cache() to implement Record.refresh().

  • Property Client.verbose to enable/disable logging.

  • Support odooly https://demo.odoo.com for simplicity.

2.4.7 (2025-11-07)

  • Interactive: add possibility to change verbosity. E.g.: client._printer.cols = 180. Set to 0 to disable.

  • Retrieve models when user does not have access to ir.model. Only for Odoo 15 there’s no workaround. For Odoo >= 16 a method get_available_models is available to all users.

  • Do not list transient models with Env.models().

  • Enhance error management for JSON-2 API with Odoo >= 19.

  • Improve type-checking for write methods.

  • Handle fields.Serialized fields without error.

2.4.6 (2025-10-31)

  • For WebAPI and JSON-RPC, do not print traceback for common Odoo errors, like UserError and ValidationError.

  • Fix sudo() KeyError in some cases.

  • Do not raise an error when a field is read on a ghost Record.

  • Fix HTTP session error when switching to a different database.

2.4.5 (2025-10-30)

  • Configure server = ... instead of scheme / host / port / protocol.

  • Better error message for in operator on RecordList.

  • Use display_name instead of name_get() for Odoo >= 8, because name_get is deprecated in Odoo 17 and removed in Odoo 18.

  • Remove workaround not needed anymore for interactive console. Issue was fixed in Python source code.

2.4.4 (2025-10-16)

  • Support {...} string format for RecordList.read() and Model.read().

  • Use search_read method with Odoo >= 8.

  • Fix cache when switching between environments.

  • Use a separate HTTP session when using JSON-2 API Key.

  • Change Model.sudo() and RecordList.sudo() to become Superuser, on Odoo >= 12.

  • Fix ResourceWarning with Python 3.14.

2.4.3 (2025-10-12)

  • Add operators not =like and not =ilike for Odoo 19.

  • Fix API Key authentication for RPC protocols.

  • Able to connect with HTTP redirection. For example: odooly --server http://demo.odoo.com

  • Add method Client.save() to save current environment in memory, with a name. Change Client.get_config() to a class method.

  • Fix command line usage with a list of IDs.

  • Keep env.user.login when env.user.refresh() is called.

  • Obfuscate Env.context in cache key.

2.4.2 (2025-10-08)

2.4.1 (2025-10-06)

  • Catch and format authentication error properly.

  • Print errors when verbose is enabled.

  • Fix 2FA authentication retry, when code is invalid.

  • Fix incorrect data serialization when JSON is empty {}.

  • Try to login even if database is not set, with Odoo >= 10.

  • Fix Web authentication for Odoo 10 to 14.

  • Ask for confirmation before (un)installing dependent modules.

  • Propose database selector when needed, even for JSON-2 authentication.

  • Support --api-key on the command line.

2.4.0 (2025-10-03)

  • Store Env.session_info when it is retrieved with Webclient API. Insert user_context into session_info when RPC API is used.

  • Add a database selector for Webclient API.

  • Method exists becomes private with Odoo 19.

  • Fix method Env.upgrade_cancel() for Odoo 19.

  • Fix parsing version of Saas instances.

  • New static method Client.get_config()

  • Support JSON-2 API with Odoo >= 19.

  • Configure api_key separately. Allow to use JSON-2 even if password is not configured.

  • New method Env.generate_api_key() for Odoo >= 14.

  • Support methods protected by check_identity, for Odoo >= 14.

2.3.2 (2025-10-01)

  • Print HTTP error status when error occurs.

  • Support env._web.session('get_session_info') as alternative to client.web_session.get_session_info(), for example.

  • When using Webclient, database = configuration becomes optional.

  • Method Model.sudo() defaults to 'admin' user, instead of UID 1.

  • Simplify authentication, passwords are encrypted since Odoo 12 and values cannot be retrieved by 'admin'.

  • Add API overview table to the documentation: availability and authentication mode per Odoo version.

2.3.1 (2025-09-30)

  • Fix context_get arguments.

  • Do not authenticate with /web/session/authenticate when protocol is jsonrpc or xmlrpc. It cannot authenticate API keys.

  • Experimental support for 2FA with Webclient session, with Odoo >= 15.

  • Fix PyPI classifiers.

  • Update documentation.

2.3.0 (2025-09-29)

  • Support webclient WebAPI protocol as an alternative: /web/dataset/*, /web/database/*, … Webclient API is stable since Odoo 9.

  • Authenticate with /web/session/authenticate by default and retrieve Env.session_info, with Odoo >= 9.

  • Use Webclient API by default when protocol is not set. It is same as setting protocol = web.

  • New function Client.drop_database().

  • New functions to create/destroy a session: Env.session_authenticate() and Env.session_destroy().

  • Drop support for Python 3.5.

2.2.1 (2025-09-24)

2.2.0 (2025-09-16)

  • Support for Odoo 17, 18 and 19.

  • Support Python 3.12 and 3.13.

  • Drop support for Python 2.7 and Python 3.4.

  • Enable Github Actions CI. Remove Travis CI.

  • Support new search operators: any|not any|parent_of.

2.1.9 (2019-10-02)

  • No change. Re-upload to PyPI.

2.1.8 (2019-10-02)

  • Default location for the configuration file is the initial working directory.

  • Enhanced syntax for method RecordList.filtered(). E.g. instead of records.filtered(lambda r: r.type == 'active') it’s faster to use records.filtered(['type = active']).

  • Support unary operators even for Python 3.

  • Basic sequence operations on Env instance.

2.1.7 (2019-03-20)

  • No change. Re-upload to PyPI.

2.1.6 (2019-03-20)

  • Fix RecordList.mapped() method with empty one2many or many2many fields.

  • Hide arguments of partial objects.

2.1.5 (2019-02-12)

  • Fix new feature of 2.1.4.

2.1.4 (2019-02-12)

  • Support env['res.partner'].browse() and return an empty RecordList.

2.1.3 (2019-01-09)

  • Fix a bug where method with_context returns an error if we update the values of the logged-in user before.

  • Allow to call RPC method env['ir.default'].get(...) thanks to a passthrough in the Model.get() method.

2.1.2 (2019-01-02)

  • Store the cursor Env.cr on the Env instance in local mode.

  • Drop support for Python 3.2 and 3.3.

2.1.1 (2019-01-02)

  • Do not call ORM method exists on an empty list because it fails with OpenERP.

  • Provide cursor Env.cr in local mode, even with OpenERP instances.

  • Optimize and fix method RecordList.filtered().

2.1 (2018-12-27)

  • Allow to bypass SSL verification if the server is misconfigured. Environment variable ODOOLY_SSL_UNVERIFIED=1 is detected.

  • Accept multiple command line arguments for local mode. Example: odooly -- --config path/to/odoo.conf --data-dir ./var

  • Add self to the globals() in interactive mode, to mimic Odoo shell.

  • On login, assign the context of the user: env['res.users'].context_get(). Do not copy the context when switching database, or when connecting with a different user.

  • Drop attribute Client.context. It is only available as Env.context.

  • Fix hashing error when Env.context contains a list.

  • Assign the model name to Record._name.

  • Fix installation/upgrade with an empty list.

  • Catch error when database does not exist on login.

  • Format other Odoo errors like DatabaseExists.

2.0 (2018-12-12)

  • Fix cache of first Env in interactive mode.

  • Correctly invalidate the cache after installing/upgrading add-ons.

  • Add tests for Model.with_context(), Model.sudo() and Env.sudo().

  • Copy the context when switching database.

  • Change interactive prompt sys.ps2 to "     ... ".

2.0b3 (2018-12-10)

  • Provide Env.sudo() in addition to same method on Model, RecordList and Record instances.

  • Workflows and method object.exec_workflow are removed in Odoo 11.

  • Do not prevent login if access to Client.db.list() is denied.

  • Use a cache of Env instances.

2.0b2 (2018-12-05)

2.0b1 (2018-12-04)

  • First release of Odooly, which mimics the new Odoo 8.0 API.

  • Other features are copied from ERPpeek 1.7.