Billing Entity Management #66
1 changed files with 10 additions and 3 deletions
|
@ -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"],
|
||||
tobru marked this conversation as resolved
Outdated
|
||||
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]
|
||||
tobru marked this conversation as resolved
Outdated
tobru
commented
A user in the Servala Portal which matches an internal user in Odoo should be able to see all invoice addresses, like they do when they log in to the Odoo backend. I figured out that the "Internal Users" filter in Odoo uses the domain A user in the Servala Portal which matches an internal user in Odoo should be able to see all invoice addresses, like they do when they log in to the Odoo backend. I figured out that the "Internal Users" filter in Odoo uses the domain `('share', '=', False)` ([L342](https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/views/res_users_views.xml#L342)) so let's use the same to decide if the user can see all invoice addresses. There are also "Portal Users" in Odoo, they should not see all invoice addresses and behave like a normal Servala Portal user.
|
||||
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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue
Enhance the domain to include
('active','=',True)
to make sure the user is active in Odoo.