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

Module: Project Forecast Lines

Entity: hr.employee

Compute Method: _compute_main_role_id

Inputs Method Outputs
today = fields.Date.context_today(self)
for rec in self:
            rec.main_role_id = rec.role_ids.filtered(
                lambda r: r.date_start <= today and (r.date_end >= today)
                if r.date_end
                else True
            )[:1].role_id

Back to entity