OdooClient¶
The main entry point for interacting with Odoo. Domain operations are available as namespace properties on the client instance.
Domain Namespaces¶
| Property | Class | Description |
|---|---|---|
client.helpdesk |
HelpdeskNamespace |
Helpdesk ticket operations |
client.crm |
CRMNamespace |
CRM lead/opportunity operations |
client.tasks |
TaskNamespace |
Project task operations |
client.projects |
ProjectNamespace |
Project operations |
client.knowledge |
KnowledgeNamespace |
Knowledge article operations |
client.timer |
TimerNamespace |
Timer and timesheet management |
client.security |
SecurityNamespace |
Security group management |
client.generic |
GenericNamespace |
Generic model operations |
from vodoo import OdooClient, OdooConfig
config = OdooConfig(url="https://my.odoo.com", database="mydb",
username="bot@example.com", password="api-key")
with OdooClient(config) as client:
tickets = client.helpdesk.list(limit=10)
client.helpdesk.comment(42, "fixed")
leads = client.crm.list(limit=5)
tasks = client.tasks.list(limit=5)
OdooClient
¶
OdooClient(config: OdooConfig, *, transport: OdooTransport | None = None, auto_detect: bool = True)
Odoo client for external API access.
Wraps an OdooTransport to provide a convenient interface for Odoo operations. Supports both legacy JSON-RPC (Odoo 14-18) and JSON-2 API (Odoo 19+).
Initialize Odoo client.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
Odoo configuration
TYPE:
|
transport
|
Explicit transport instance (skips auto-detection)
TYPE:
|
auto_detect
|
If True and no transport given, probe JSON-2 first then fall back to legacy. If False, use legacy directly.
TYPE:
|
Source code in src/vodoo/client.py
close
¶
execute
¶
Execute a method on an Odoo model.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
Odoo model name (e.g., 'helpdesk.ticket')
TYPE:
|
method
|
Method name (e.g., 'search', 'read')
TYPE:
|
*args
|
Positional arguments for the method
TYPE:
|
**kwargs
|
Keyword arguments for the method
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
Method result |
Source code in src/vodoo/client.py
execute_sudo
¶
Execute a method as another user using sudo.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
Odoo model name
TYPE:
|
method
|
Method name
TYPE:
|
user_id
|
User ID to execute as
TYPE:
|
*args
|
Positional arguments
TYPE:
|
**kwargs
|
Keyword arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
Method result |
Source code in src/vodoo/client.py
search
¶
search(model: str, domain: list[Any] | None = None, limit: int | None = None, offset: int = 0, order: str | None = None) -> list[int]
Search for records.
Source code in src/vodoo/client.py
read
¶
search_read
¶
search_read(model: str, domain: list[Any] | None = None, fields: list[str] | None = None, limit: int | None = None, offset: int = 0, order: str | None = None) -> list[dict[str, Any]]
Search and read records in one call.
Source code in src/vodoo/client.py
create
¶
write
¶
unlink
¶
fields_get
¶
fields_get(model: str, fields: list[str] | None = None, attributes: list[str] | None = None) -> dict[str, Any]
Return field definitions for a model.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
Odoo model name (e.g.,
TYPE:
|
fields
|
Optional list of field names to inspect.
TYPE:
|
attributes
|
Optional list of field attributes to return
(e.g.,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary mapping field names to their attribute dicts. |
Source code in src/vodoo/client.py
name_search
¶
name_search(model: str, name: str, domain: list[Any] | None = None, limit: int = 7) -> list[tuple[int, str]]
Autocomplete search returning (id, display_name) pairs.