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

Module: Appraisal Oca

Entity: hr.employee

Compute Method: _compute_allowed_user_ids

Inputs Method Outputs
  • parent_id
"""Compute all allowed user IDs by traversing the manager hierarchy."""
for employee in self:
            allowed_users = set()
            visited = set()
            current = employee.parent_id
            while current and current.id not in visited:
                visited.add(current.id)
                if current.user_id:
                    allowed_users.add(current.user_id.id)
                current = current.parent_id
            employee.allowed_user_ids = [(6, 0, list(allowed_users))]

Back to entity