Odoo JSON-2 API client for Odoo 19+
Project description
pyodoo-client (Odoo 19+ JSON-2)
Python client for Odoo JSON-2 API (/json/2) targeting Odoo 19+.
Features
- JSON-2 model calls with named payloads.
- ORM-like model access (
client.model("res.partner")). OdooEntityconvenience wrapper (save,delete,refresh).- Context layering (
default_context,with_context, per-callcontext). - Runtime
debugmode toggle:debug=False: returns safe defaults and stores errors.debug=True: raises exceptions.
- Database service wrappers for
/web/versionand/web/database/*.
Installation
pip install pyodoo-client
Quick Start
from pyodoo_client import OdooClient
odoo = OdooClient(
url="https://mycompany.example.com",
db="mycompany",
api_key="YOUR_API_KEY",
debug=False,
)
partners = odoo.model("res.partner").search_read({
"context": {"lang": "en_US"},
"domain": [
["name", "ilike", "%deco%"],
["is_company", "=", True],
],
"fields": ["name"],
})
API Overview
OdooClient
OdooClient(url, api_key=None, key=None, db=None, timeout=30, verify_ssl=True, user_agent="pyodoo-client", debug=False, default_context=None)model(model_name)set_debug(bool)set_default_context(dict)/update_default_context(dict)call_model(model_name, method, payload=None, context=None, debug=None, default=None)call_web(method, path, ...)databaseservice property
OdooModel
with_context(dict)set_debug(bool)execute(method, *args, **kwargs)- CRUD helpers:
search,search_read,read,create,write,unlink,fields_get
OdooEntity
id,exists(),refresh()get_data(fields=None)save(),delete()
Compatibility Notes
- For common ORM methods, limited positional compatibility is provided.
- For custom methods, use named dict payloads:
model = odoo.model("your.model")
result = model.your_method({"param_a": 1, "param_b": "x"})
JSON-2 does not support positional arguments for method parameters.
Database Service
version = odoo.database.version()
dbs = odoo.database.list()
exists = odoo.database.db_exist("mycompany")
Includes wrappers:
version,server_version,list,db_existcreate_database,duplicate_database,dropchange_admin_password,backup,restore,neutralize_database
Error Handling
- Last error available on
client.errorormodel.error. - Set
debug=Trueto raise exceptions immediately.
Supported Odoo Range
- Intended for Odoo 19+ using JSON-2 API.
- RPC deprecation in Odoo 20 is accounted for by using
/json/2transport.
Contributing
- Open Issues for bugs and concrete feature requests.
- Open Pull Requests for code/docs improvements.
- For open-ended questions and ideas, use GitHub Discussions (enable in repo settings).
- See
CONTRIBUTING.mdfor workflow and expectations.
Development
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyodoo_client-19.0.0.tar.gz
(10.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyodoo_client-19.0.0.tar.gz.
File metadata
- Download URL: pyodoo_client-19.0.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6b861f1bc3f91d50c8296ead79f50f3928628034e981a08fe4a447d8c84c10e
|
|
| MD5 |
29c7fc53c348bb7e36900522c3880e55
|
|
| BLAKE2b-256 |
d3f064ca72313f447a400c0751833506900e552da56477f2d99dd9710a93bc69
|
File details
Details for the file pyodoo_client-19.0.0-py3-none-any.whl.
File metadata
- Download URL: pyodoo_client-19.0.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d31431fa94d770bc50b43db850ad7da22a94ea02cb031e7573f0119d5d1bb39e
|
|
| MD5 |
e1f6797385be661d6c371ac0ad110716
|
|
| BLAKE2b-256 |
340ae50b2863dbb0bdcdf03c1879ef6c2f11b493447fff83243592f0f9ffaee0
|