fix: make Odoo login configurable via ODOO_USER (default __system__)

Some Odoo instances require the user's actual login/email for API key
auth rather than the __system__ special login. ODOO_USER defaults to
__system__ for standard Odoo 16+ installs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Garcia
2026-04-24 19:15:06 -04:00
parent 65e471b6ce
commit 590f1b7ee2
3 changed files with 5 additions and 2 deletions

View File

@@ -37,10 +37,11 @@ class OdooWriteError(Exception): pass
class OdooClient:
def __init__(self, url, db, api_key, pg_dsn=None, pg_pool_min=2, pg_pool_max=10):
def __init__(self, url, db, api_key, user='__system__', pg_dsn=None, pg_pool_min=2, pg_pool_max=10):
self._url = url.rstrip('/')
self._db = db
self._api_key = api_key
self._user = user
self._pg_dsn = pg_dsn
self._pg_pool_min = pg_pool_min
self._pg_pool_max = pg_pool_max
@@ -77,7 +78,7 @@ class OdooClient:
try:
uid = await self._xmlrpc_call(
self._common, 'authenticate',
self._db, '__system__', self._api_key, {})
self._db, self._user, self._api_key, {})
if not uid:
raise OdooAuthError('Authentication failed - check ODOO_API_KEY')
self._uid = uid