Skip to main content

Library for controlling odoo-bin for run, update, install and test modules

Project description

PyPI - Version PyPI - Python Version PyPI - Downloads codecov

oduit

oduit is an Odoo CLI and Python utility layer with strong addon, dependency, and manifest introspection.

It helps with common Odoo workflows such as run, install, update, and test, but its sharper value is in structured automation and addon intelligence:

  • doctor for environment diagnostics
  • version for Odoo version detection
  • list-addons, print-manifest, list-manifest-values
  • list-depends, install-order, impact-of-update
  • structured JSON output for CI and editor integrations

Installation

pip install oduit

Without Installing

uvx oduit

Quick Start

Create a local .oduit.toml:

[binaries]
python_bin = "./venv/bin/python"
odoo_bin = "./odoo/odoo-bin"

[odoo_params]
addons_path = "./addons"
db_name = "project_dev"

Then run:

oduit doctor
oduit version
oduit list-addons
oduit install-order sale,purchase
oduit impact-of-update sale

Named environments work the same way via ~/.config/oduit/<env>.toml:

oduit --env dev doctor
oduit --env dev run
oduit --env dev test --test-tags /sale

CLI Highlights

# Diagnostics
oduit doctor
oduit --env dev doctor
oduit --json doctor

# Version detection
oduit --env dev version

# Addon intelligence
oduit --env dev list-addons
oduit --env dev print-manifest sale
oduit --env dev list-manifest-values category
oduit --env dev list-depends sale
oduit --env dev install-order sale,purchase
oduit --env dev impact-of-update sale

# Operations
oduit --env dev install sale
oduit --env dev update sale
oduit --env dev test --test-tags /sale
oduit --env dev shell
oduit --env dev create-addon my_custom_module
oduit --env dev export-lang sale --language de_DE

JSON Output Contract

Commands run with --json emit versioned payloads for automation.

Guaranteed keys for result payloads:

  • schema_version
  • type
  • success

Common keys when they apply:

  • operation
  • command
  • return_code
  • stdout / stderr
  • error / error_type

Example:

{
  "schema_version": "1",
  "type": "result",
  "success": true,
  "operation": "get_odoo_version",
  "version": "17.0",
  "return_code": 0
}

Python API

High-Level Operations

from oduit import ConfigLoader, OdooOperations

loader = ConfigLoader()
config = loader.load_config("dev")
ops = OdooOperations(config, verbose=True)

install_result = ops.install_module("sale")
test_result = ops.run_tests(module="sale")
version_result = ops.get_odoo_version(suppress_output=True)
db_result = ops.db_exists(suppress_output=True)

Addon Intelligence

from oduit import ConfigLoader, ModuleManager

loader = ConfigLoader()
config = loader.load_config("dev")
manager = ModuleManager(config["addons_path"])

addons = manager.find_modules()
sale_manifest = manager.get_manifest("sale")
depends = manager.get_direct_dependencies("sale")
install_order = manager.get_install_order("sale", "purchase")
reverse_deps = manager.get_reverse_dependencies("sale")

Safe Read-Only Queries

from oduit import OdooQuery

query = OdooQuery(config)

partners = query.query_model(
    "res.partner",
    domain=[("customer_rank", ">", 0)],
    fields=["name", "email"],
    limit=5,
)

count = query.search_count("res.partner", domain=[("is_company", "=", True)])
fields = query.get_model_fields("res.partner", attributes=["string", "type"])

Raw Trusted Execution

Use OdooCodeExecutor only for trusted arbitrary code.

from oduit.config_provider import ConfigProvider
from oduit.odoo_code_executor import OdooCodeExecutor

executor = OdooCodeExecutor(ConfigProvider(config))
result = executor.execute_code(
    "env['res.partner'].search_count([])",
    allow_unsafe=True,
)

allow_unsafe=True is still required for arbitrary code execution.

Configuration

Preferred format: sectioned TOML.

Compatibility support still exists for:

  • flat config files
  • YAML environment files

For existing Odoo configs, import them with:

oduit init dev --from-conf /path/to/odoo.conf

Why Structured Results Matter

OperationResult-based workflows can fail semantically even when the process exit code is 0, for example when Odoo reports unmet dependencies or test failures in log output. That parsed structure is available in both Python and JSON output.

Development

pytest
ruff check --fix --exit-non-zero-on-fix --config=.ruff.toml
ruff format --check

License

This project is licensed under the Mozilla Public License 2.0. See LICENSE.

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

oduit-0.3.0.tar.gz (199.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oduit-0.3.0-py3-none-any.whl (109.1 kB view details)

Uploaded Python 3

File details

Details for the file oduit-0.3.0.tar.gz.

File metadata

  • Download URL: oduit-0.3.0.tar.gz
  • Upload date:
  • Size: 199.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oduit-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c7e298f47977819a8d3f62a4795c17ab93ea8e2476f2223313e9b5f00b3bb2f9
MD5 970608e0e6692e7480c86ce4e2b23e55
BLAKE2b-256 68631521334b6a86eb008b404914ee72d96e835a506b28da465ee1b0e2cf2061

See more details on using hashes here.

File details

Details for the file oduit-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: oduit-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 109.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oduit-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cb688caa46cf05fff672e614ef84301c9747e2bcb237407273212061251c848
MD5 0eecb5e06b77f91190cf473a2adc1359
BLAKE2b-256 a20177faafa9e582a64128454b19668b945afa541de0059039ae46b9d98adbb9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page