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

Module: Project HR

Entity: res.users

Compute Method: _compute_hr_category_ids

Inputs Method Outputs
  • employee_ids
"""It is important to use the company employee (self.env.company) because
        it is possible that the user's company (user.company_id) is not listed
        as an allowed company (allowed_company_ids) and therefore the employee
        is not in the employee_ids field.
        """
for user in self:
            user.hr_category_ids = user.employee_ids.filtered(
                lambda x, company_id=self.env.company: x.company_id == company_id
            )[:1].category_ids

Back to entity