Async Auth¶
Async authentication utilities and sudo operations.
auth
¶
Async authentication utilities for Vodoo.
Mirrors :mod:vodoo.auth with async methods.
get_default_user_id
async
¶
get_default_user_id(client: AsyncOdooClient, username: str | None = None) -> int
Get the default user ID for sudo operations.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
Async Odoo client
TYPE:
|
username
|
Username to search for (defaults to configured username)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
User ID |
| RAISES | DESCRIPTION |
|---|---|
RecordNotFoundError
|
If user not found |
Source code in src/vodoo/aio/auth.py
get_partner_id_from_user
async
¶
get_partner_id_from_user(client: AsyncOdooClient, user_id: int) -> int
Get the partner ID associated with a user.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
Async Odoo client
TYPE:
|
user_id
|
User ID (res.users)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
Partner ID (res.partner) |
| RAISES | DESCRIPTION |
|---|---|
RecordNotFoundError
|
If user not found or has no partner |
Source code in src/vodoo/aio/auth.py
message_post_sudo
async
¶
message_post_sudo(client: AsyncOdooClient, model: str, res_id: int, body: str, user_id: int | None = None, message_type: str = 'comment', is_note: bool = False, **kwargs: Any) -> bool
Post a message or note as a specific user using sudo.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
Async Odoo client
TYPE:
|
model
|
Model name (e.g., 'helpdesk.ticket')
TYPE:
|
res_id
|
Record ID
TYPE:
|
body
|
Message body (HTML)
TYPE:
|
user_id
|
User ID to post as (uses default if None)
TYPE:
|
message_type
|
Type of message ('comment' or 'notification')
TYPE:
|
is_note
|
If True, creates an internal note
TYPE:
|
**kwargs
|
Additional arguments for message_post
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if successful |
| RAISES | DESCRIPTION |
|---|---|
ConfigurationError
|
If no default user configured |