Transport¶
Transport abstraction for Odoo JSON-RPC and JSON-2 protocols.
transport
¶
Odoo JSON-RPC transport abstraction.
Provides two implementations:
- LegacyTransport: Odoo 14-18 using POST /jsonrpc with service/method/args envelope
- JSON2Transport: Odoo 19+ using POST /json/2/
OdooTransport
¶
OdooTransport(url: str, database: str, username: str, password: str, *, timeout: int = 30, retry: RetryConfig | None = None, extra_headers: dict[str, str] | None = None)
Bases: ABC
Abstract base for Odoo RPC transports.
Each transport knows how to authenticate, call model methods, and perform CRUD operations. The public API is identical regardless of the underlying protocol (legacy JSON-RPC or JSON-2 REST).
Source code in src/vodoo/transport.py
authenticate
abstractmethod
¶
Authenticate and return the user ID.
| RAISES | DESCRIPTION |
|---|---|
AuthenticationError
|
If authentication fails. |
execute_kw
abstractmethod
¶
Execute a method on an Odoo model (execute_kw equivalent).
| PARAMETER | DESCRIPTION |
|---|---|
model
|
Odoo model name (e.g., 'project.task')
TYPE:
|
method
|
Method name (e.g., 'search_read')
TYPE:
|
args
|
Positional arguments
TYPE:
|
kwargs
|
Keyword arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
Method result |
| RAISES | DESCRIPTION |
|---|---|
TransportError
|
On RPC/HTTP errors. |
Source code in src/vodoo/transport.py
call_service
abstractmethod
¶
Call a JSON-RPC service method (e.g. common/authenticate).
| PARAMETER | DESCRIPTION |
|---|---|
service
|
Service name ('common', 'object', 'db')
TYPE:
|
method
|
Method name
TYPE:
|
args
|
Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
Result |
| RAISES | DESCRIPTION |
|---|---|
TransportError
|
On RPC/HTTP errors. |
Source code in src/vodoo/transport.py
close
¶
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.
Source code in src/vodoo/transport.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 record IDs.
Source code in src/vodoo/transport.py
read
¶
Read records by IDs.
Source code in src/vodoo/transport.py
create
¶
Create a record and return its ID.
Source code in src/vodoo/transport.py
write
¶
unlink
¶
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.
Source code in src/vodoo/transport.py
LegacyTransport
¶
LegacyTransport(url: str, database: str, username: str, password: str, *, timeout: int = 30, retry: RetryConfig | None = None, extra_headers: dict[str, str] | None = None)
Bases: OdooTransport
Odoo 14-18 legacy JSON-RPC transport.
Uses POST /jsonrpc with service/method/args envelope.
Source code in src/vodoo/transport.py
JSON2Transport
¶
JSON2Transport(url: str, database: str, username: str, password: str, *, timeout: int = 30, retry: RetryConfig | None = None, extra_headers: dict[str, str] | None = None)
Bases: OdooTransport
Odoo 19+ JSON-2 API transport.
Uses POST /json/2/