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

Module: Employees

Entity: hr.job

Compute Method: _compute_allowed_user_ids

View 19.0
Inputs Method Outputs
  • company_id
- company_ids = self.mapped("company_id.id")
- domain = [("share", "=", False)]
- if company_ids:
-             domain += [("company_ids", "in", company_ids)]
- users_by_company = dict(
-             self.env["res.users"]._read_group(
-                 domain=domain,
-                 groupby=["company_id"],
-                 aggregates=["id:recordset"],
-             ),
-         )
- all_users = self.env["res.users"]
- for users in users_by_company.values():
-             all_users |= users
- for job in self:
-             job.allowed_user_ids = users_by_company.get(job.company_id, all_users)
  • allowed_user_ids

Back to entity