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 |
Source code in src/vodoo/auth.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |