Skip to main content

🚀 odoo-json2

CI Python Version Odoo Version License: MIT Managed with uv Styled with Rich

The Modern Python Client & CLI for Odoo 19+ External JSON-2 API (/json/2)
Built with uv, rich terminal output, type annotations, and 100% odoorpc backward-compatible env['model_name'] syntax.


⚡ Why odoo-json2?

Starting in Odoo 19.0, legacy XML-RPC (/xmlrpc, /xmlrpc/2), JSON-RPC (/jsonrpc), and legacy libraries like odoorpc are deprecated and scheduled for complete removal in Odoo 22 (Fall 2028).

odoo-json2 is designed to be the premier Python library for Odoo 19+ external integrations:

  • 🔒 Bearer API Key Authentication: Uses Odoo 19's native Authorization: bearer <API_KEY> scheme.
  • Zero-Rewrite Migration from odoorpc: Supports the exact client.env['res.partner'] syntax you already know.
  • 🎨 Rich Terminal Experience: Beautiful CLI with colorized tables, progress spinners, JSON syntax highlighting, and model inspection powered by rich.
  • 📦 Modern Tooling: Package managed with uv and standard pyproject.toml.

📦 Installation

# Using uv (Recommended)
uv add odoo-json2

# Using pip
pip install odoo-json2

🚀 Quickstart

1. Python API

from odoo_json2 import JSON2Client

# Initialize client with host and Bearer API Key
client = JSON2Client(
    host="mycompany.odoo.com",
    api_key="your_160bit_bearer_api_key",
    database="mycompany"
)

# Access models via odoorpc-style env dictionary syntax
Partner = client.env["res.partner"]

# Search and read records
companies = Partner.search_read(
    domain=[("is_company", "=", True)],
    fields=["name", "email", "phone"],
    limit=5
)
print(companies)

# Create record
new_id = Partner.create({
    "name": "Acme Global",
    "email": "contact@acme.example",
    "is_company": True
})

# Write / Update record
Partner.write([new_id], {"phone": "+1-800-555-0199"})

# Delete record
Partner.unlink([new_id])

💻 Rich CLI Usage

odoo-json2 includes a built-in CLI tool with rich formatting:

# Test connection & display Odoo server info
odoo-json2 --host mycompany.odoo.com --key YOUR_API_KEY test-connection

# Inspect model fields, data types, and record count in a Rich table
odoo-json2 inspect res.partner --limit 20

# Search records and print formatted Rich table or JSON
odoo-json2 search res.partner --domain '[["is_company", "=", true]]' --fields "id,name,email"
odoo-json2 search res.partner --json

📁 Examples & Documentation

Explore the examples/ directory for ready-to-run scripts:


🔄 Migration Matrix: odoorpc -> odoo-json2

Feature Legacy odoorpc odoo-json2
API Endpoint /xmlrpc/2/object / /jsonrpc /json/2/<model>/<method>
Authentication login(db, user, password) Authorization: bearer <API_KEY>
Model Access Partner = odoo.env['res.partner'] Partner = client.env['res.partner']
Search & Read Partner.search_read(domain, fields) Partner.search_read(domain, fields)
Create Partner.create(vals_dict) Partner.create(vals_dict)
Update / Write Partner.write(ids, vals_dict) Partner.write(ids, vals_dict)
Delete / Unlink Partner.unlink(ids) Partner.unlink(ids)

🧪 Development & Testing

# Clone repository
git clone https://github.com/Noizrom/odoo-json2.git

# Install dependencies with uv
uv pip install -e ".[dev]"

# Run test suite
uv run python -m pytest -p no:xonsh

📄 License

Distributed under the MIT License. See LICENSE for details.

Release files for odoo-json2 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for odoo-json2 0.2.0
File Size Uploaded
odoo_json2-0.2.0.tar.gz 16.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for odoo-json2 0.2.0
File Interpreter ABI Platform
odoo_json2-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 kB

Release files / odoo_json2-0.2.0.tar.gz

Download URL odoo_json2-0.2.0.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b342be35b78f611474d5252cafa3b943f8fe7920b3f019cc3eb7f5c86f934268
BLAKE2b-256 checksum
How to use checksums
4a9d42ba52974ce0e4546b30e063cfbd903c473f7851a945c05724e94ec46654
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.

Transparency log

Release files / odoo_json2-0.2.0-py3-none-any.whl

Download URL odoo_json2-0.2.0-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44592f842c0302c3375e77fc7dc1026e6a7c772d4b578546f63800caded95c05
BLAKE2b-256 checksum
How to use checksums
8e34a0638e0dfd3433b5b2be9ac26578f8c042c3171f9bba6f3b0491a45f542b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page