You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All operating units added to res.user when edit any group.
PR: #629
Module
operating_unit
Describe the bug
Odoo v16, multicompany database.
On user form, when change group for that user, all operating unit are automatically added to field operating_unit_ids (Allowed Operating Units).
I debug this code:
@api.depends("groups_id", "assigned_operating_unit_ids")
def _compute_operating_unit_ids(self):
for user in self:
if user.has_group("operating_unit.group_manager_operating_unit"):
dom = []
if self.env.context.get("allowed_company_ids"):
dom = [
"|",
("company_id", "=", False),
("company_id", "in", self.env.context["allowed_company_ids"]),
]
else:
dom = []
user.operating_unit_ids = self.env["operating.unit"].sudo().search(dom)
else:
user.operating_unit_ids = user.assigned_operating_unit_ids
And user = res.users(,).
With this result, has_group("operating_unit.group_manager_operating_unit") always return True.
I don't know why the result of user is this, but with user._origin.has_group("operating_unit.group_manager_operating_unit") everything seems to work.
Anyone encountering the same problem?
The text was updated successfully, but these errors were encountered:
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.
All operating units added to res.user when edit any group.
PR: #629
Module
operating_unit
Describe the bug
Odoo v16, multicompany database.
On user form, when change group for that user, all operating unit are automatically added to field operating_unit_ids (Allowed Operating Units).
I debug this code:
And user = res.users(,).
With this result, has_group("operating_unit.group_manager_operating_unit") always return True.
I don't know why the result of user is this, but with user._origin.has_group("operating_unit.group_manager_operating_unit") everything seems to work.
Anyone encountering the same problem?
The text was updated successfully, but these errors were encountered: