Async Base Operations¶
Async shared CRUD, messaging, and attachment helpers used by async domain namespaces.
base
¶
Async base operations for Odoo models.
Provides async versions of I/O functions from :mod:vodoo.base.
Pure display/formatting functions are re-exported unchanged.
configure_output
¶
configure_output(*, console: Any = None, simple: bool = False, json_mode: bool = False, toon_mode: bool = False) -> None
Deprecated compatibility shim for :func:vodoo.cli.output.configure_output.
Source code in src/vodoo/base.py
display_attachments
¶
display_messages
¶
Deprecated compatibility shim for CLI message rendering.
display_record_detail
¶
display_record_detail(record: dict[str, Any], *, show_html: bool = False, record_type: str = 'Record') -> None
Deprecated compatibility shim for CLI record-detail rendering.
Source code in src/vodoo/base.py
display_records
¶
display_tags
¶
get_record_url
¶
get_record_url(client: OdooClient | Any, model: str, record_id: int) -> str
Get the web URL for a record.
Uses the canonical path URL for a selected JSON-2 transport and the legacy hash URL otherwise. Works with sync and async clients without making an additional request.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
Odoo client (sync or async)
TYPE:
|
model
|
Model name
TYPE:
|
record_id
|
Record ID
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
URL to view the record in Odoo web interface |
Examples:
>>> get_record_url(client, "helpdesk.ticket", 42)
'https://odoo.example.com/web#id=42&model=helpdesk.ticket&view_type=form'
Source code in src/vodoo/base.py
list_records
async
¶
list_records(client: AsyncOdooClient, model: str, domain: list[Any] | None = None, limit: int | None = 50, fields: list[str] | None = None, order: str = 'create_date desc') -> list[dict[str, Any]]
List records from a model.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
Async Odoo client
TYPE:
|
model
|
Model name
TYPE:
|
domain
|
Search domain filters
TYPE:
|
limit
|
Maximum number of records
TYPE:
|
fields
|
List of fields to fetch
TYPE:
|
order
|
Sort order
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[dict[str, Any]]
|
List of record dictionaries |
Source code in src/vodoo/aio/base.py
get_record
async
¶
get_record(client: AsyncOdooClient, model: str, record_id: int, fields: list[str] | None = None) -> dict[str, Any]
Get detailed record information.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
Async Odoo client
TYPE:
|
model
|
Model name
TYPE:
|
record_id
|
Record ID
TYPE:
|
fields
|
List of field names to read
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Record dictionary |
| RAISES | DESCRIPTION |
|---|---|
RecordNotFoundError
|
If record not found |
Source code in src/vodoo/aio/base.py
list_fields
async
¶
list_fields(client: AsyncOdooClient, model: str) -> dict[str, Any]
set_record_fields
async
¶
set_record_fields(client: AsyncOdooClient, model: str, record_id: int, values: dict[str, Any]) -> bool
add_comment
async
¶
add_comment(client: AsyncOdooClient, model: str, record_id: int, message: str, user_id: int | None = None, markdown: bool = True) -> bool
Add a comment, requesting cross-user authorship only for internal users.
Source code in src/vodoo/aio/base.py
add_note
async
¶
add_note(client: AsyncOdooClient, model: str, record_id: int, message: str, user_id: int | None = None, markdown: bool = True) -> bool
Add a note, requesting cross-user authorship only for internal users.
Source code in src/vodoo/aio/base.py
list_tags
async
¶
list_tags(client: AsyncOdooClient, model: str) -> list[dict[str, Any]]
add_tag_to_record
async
¶
add_tag_to_record(client: AsyncOdooClient, model: str, record_id: int, tag_id: int) -> bool
Add a tag to a record.
Source code in src/vodoo/aio/base.py
list_messages
async
¶
list_messages(client: AsyncOdooClient, model: str, record_id: int, limit: int | None = None) -> list[dict[str, Any]]
List messages/chatter for a record.
Source code in src/vodoo/aio/base.py
list_attachments
async
¶
list_attachments(client: AsyncOdooClient, model: str, record_id: int) -> list[dict[str, Any]]
List attachments for a record.
Source code in src/vodoo/aio/base.py
download_attachment
async
¶
download_attachment(client: AsyncOdooClient, attachment_id: int, output_path: Path | None = None) -> Path
Download an attachment.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
Async Odoo client
TYPE:
|
attachment_id
|
Attachment ID
TYPE:
|
output_path
|
Output file path
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
Path to downloaded file |
| RAISES | DESCRIPTION |
|---|---|
RecordNotFoundError
|
If attachment not found |
Source code in src/vodoo/aio/base.py
download_record_attachments
async
¶
download_record_attachments(client: AsyncOdooClient, model: str, record_id: int, output_dir: Path | None = None, extension: str | None = None) -> list[Path]
Download all attachments for a record.
Source code in src/vodoo/aio/base.py
get_attachment_data
async
¶
get_attachment_data(client: AsyncOdooClient, attachment_id: int) -> bytes
Read an attachment and return its raw binary content in-memory.
Source code in src/vodoo/aio/base.py
get_record_attachment_data
async
¶
get_record_attachment_data(client: AsyncOdooClient, model: str, record_id: int) -> list[tuple[int, str, bytes]]
Read all attachments for a record and return their binary content in-memory.
Source code in src/vodoo/aio/base.py
create_attachment
async
¶
create_attachment(client: AsyncOdooClient, model: str, record_id: int, file_path: Path | str | None = None, *, data: bytes | None = None, name: str | None = None) -> int
Create an attachment for a record.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
Async Odoo client
TYPE:
|
model
|
Model name
TYPE:
|
record_id
|
Record ID
TYPE:
|
file_path
|
Path to file to attach (mutually exclusive with data)
TYPE:
|
data
|
Raw bytes to attach (mutually exclusive with file_path)
TYPE:
|
name
|
Attachment name (defaults to filename; required when using data)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
ID of created attachment |
| RAISES | DESCRIPTION |
|---|---|
FileNotFoundError
|
If file path is invalid |
ValueError
|
If arguments are invalid |
Source code in src/vodoo/aio/base.py
parse_field_assignment
async
¶
parse_field_assignment(client: AsyncOdooClient, model: str, record_id: int, field_assignment: str, no_markdown: bool = False) -> tuple[str, Any]
Parse a field assignment and return field name and computed value. HTML fields automatically get markdown conversion unless no_markdown=True.