Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Operating Unit

Entity: res.users

Compute Method: _compute_operating_unit_ids

Inputs Method Outputs
if self.env.context.get("allowed_company_ids"):
            dom = Domain.OR(
                [
                    Domain("company_id", "=", False),
                    Domain("company_id", "in", self.env.context["allowed_company_ids"]),
                ]
            )
        else:
            dom = Domain.TRUE
for user in self:
            if user.has_group("operating_unit.group_manager_operating_unit"):
                user.operating_unit_ids = self.env["operating.unit"].search(dom)
            else:
                user.operating_unit_ids = (
                    user.assigned_operating_unit_ids.filtered_domain(dom)
                )

Back to entity