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: Console | None = None, simple: bool = False, json_mode: bool = False, toon_mode: bool = False) -> None
Configure the output console and mode.
Called by the CLI layer. Library users may call this to customise display behaviour, or simply ignore it (sensible defaults apply).
Requires the cli extra (rich) when console is provided or
simple is False and display functions are subsequently called.
| PARAMETER | DESCRIPTION |
|---|---|
console
|
Rich Console instance to use for output.
TYPE:
|
simple
|
If
TYPE:
|
json_mode
|
If
TYPE:
|
toon_mode
|
If
TYPE:
|
Source code in src/vodoo/base.py
display_attachments
¶
Display attachments in a table, TSV, or JSON format.
| PARAMETER | DESCRIPTION |
|---|---|
attachments
|
List of attachment dictionaries
TYPE:
|
Source code in src/vodoo/base.py
display_messages
¶
Display messages in a formatted list or simple format.
| PARAMETER | DESCRIPTION |
|---|---|
messages
|
List of message dictionaries
TYPE:
|
show_html
|
Whether to show raw HTML body
TYPE:
|
Source code in src/vodoo/base.py
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | |
display_record_detail
¶
display_record_detail(record: dict[str, Any], *, show_html: bool = False, record_type: str = 'Record') -> None
Display detailed record information.
| PARAMETER | DESCRIPTION |
|---|---|
record
|
Record dictionary
TYPE:
|
show_html
|
If True, show raw HTML description, else convert to markdown
TYPE:
|
record_type
|
Human-readable record type (e.g., "Ticket", "Task")
TYPE:
|
Source code in src/vodoo/base.py
display_records
¶
Display records in a table, TSV, or JSON format.
| PARAMETER | DESCRIPTION |
|---|---|
records
|
List of record dictionaries
TYPE:
|
title
|
Table title
TYPE:
|
Source code in src/vodoo/base.py
display_tags
¶
Display tags in a table, TSV, or JSON format.
| PARAMETER | DESCRIPTION |
|---|---|
tags
|
List of tag dictionaries
TYPE:
|
title
|
Table title
TYPE:
|
Source code in src/vodoo/base.py
get_record_url
¶
get_record_url(client: OdooClient | Any, model: str, record_id: int) -> str
Get the web URL for a record.
Works with both sync OdooClient and async AsyncOdooClient —
only client.config.url is accessed.
| 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 to a record (visible to customers).
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 an internal note to a record (not visible to customers).
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.