oca-project/odoo-bringout-oca-project-project_hr/project_hr/models/res_users.py
Ernad Husremovic 6094c218b2 Move 124 sale modules to oca-sale, create oca-project with 56 project modules from oca-workflow-process
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 18:04:10 +02:00

23 lines
800 B
Python

# Copyright 2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ResUsers(models.Model):
_inherit = "res.users"
hr_category_ids = fields.Many2many(
comodel_name="hr.employee.category",
string="HR categories",
compute="_compute_hr_category_ids",
help="Technical field for computing dynamically employee categories "
"linked to the user in the current company.",
)
@api.depends("company_id", "employee_ids", "employee_ids.category_ids")
def _compute_hr_category_ids(self):
for user in self:
user.hr_category_ids = user.employee_ids.filtered(
lambda x: x.company_id == user.company_id
)[:1].category_ids