From 4718a01bb06d7aa7d84f3b1d04eab3852ec8fd34 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Sun, 15 Jun 2025 15:58:44 +0200 Subject: [PATCH] Show all invoice addresses to internal users --- src/servala/core/odoo.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/servala/core/odoo.py b/src/servala/core/odoo.py index 6b6baea..1e75c51 100644 --- a/src/servala/core/odoo.py +++ b/src/servala/core/odoo.py @@ -130,11 +130,18 @@ def get_invoice_addresses(user): odoo_users = CLIENT.search_read( model="res.users", domain=[("login", "=", email), ("active", "=", True)], - fields=["id"], + fields=["id", "share"], limit=1, ) - if odoo_users and (uid := odoo_users[0].get("id")): - or_conditions.append(("create_uid", "=", uid)) + + if odoo_users: + odoo_user = odoo_users[0] + if odoo_user.get("share") is False: + # An Odoo internal user (share=False) should see all invoice addresses. + or_conditions = [] + elif uid := odoo_user.get("id"): + # For portal users or users not in Odoo, apply standard filters. + or_conditions.append(("create_uid", "=", uid)) odoo_contacts = CLIENT.search_read( model="res.partner",