Auth¶
Authentication utilities and requested-author message operations. Cross-user attribution requires an internal authenticated user. Odoo may reject or override it for share users, which can reliably attribute only to their own partner. Selecting an author does not change authenticated identity, access checks, or auditing.
auth
¶
Authentication utilities for Vodoo.
get_default_user_id
¶
get_default_user_id(client: OdooClient, username: str | None = None) -> int
Get the default requested-author user ID for message operations.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
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/auth.py
get_partner_id_from_user
¶
get_partner_id_from_user(client: OdooClient, user_id: int) -> int
Get the partner ID associated with a user.
In Odoo, res.users has a partner_id field that links to res.partner. The mail.message.author_id field references res.partner, not res.users.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
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/auth.py
message_post_sudo
¶
message_post_sudo(client: OdooClient, 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 requesting a specific displayed author.
Cross-user attribution requires an internal authenticated user. Odoo may reject or override it for share users, which can reliably attribute only to their own partner. This does not change the authenticated identity, access checks, or auditing.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if successful |
Source code in src/vodoo/auth.py
message_post_sudo_with_id
¶
message_post_sudo_with_id(client: OdooClient, model: str, res_id: int, body: str, user_id: int | None = None, message_type: str = 'comment', is_note: bool = False, **kwargs: Any) -> int
Post requesting a specific displayed author and return the message ID.
Cross-user attribution requires an internal authenticated user. Odoo may reject or override it for share users, which can reliably attribute only to their own partner. This does not change the authenticated identity, access checks, or auditing.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
Odoo client
TYPE:
|
model
|
Model name (e.g., 'helpdesk.ticket')
TYPE:
|
res_id
|
Record ID
TYPE:
|
body
|
Message body (HTML)
TYPE:
|
user_id
|
User whose partner is requested as author (uses default if None)
TYPE:
|
message_type
|
Type of message ('comment' or 'notification')
TYPE:
|
is_note
|
If True, creates an internal note (not visible to customers)
TYPE:
|
**kwargs
|
Additional arguments for message_post
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
ID of the created |
| RAISES | DESCRIPTION |
|---|---|
ConfigurationError
|
If no default user configured |