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

Module: Time Off

Entity: hr.leave.allocation

Compute Method: _compute_from_employee_ids

Inputs Method Outputs
for allocation in self:
            employees = allocation.with_context(active_test=False).employee_ids
            accrual_plan = allocation.accrual_plan_id
            if len(employees) == 1 or (
                employees and not accrual_plan.is_based_on_worked_time
                and accrual_plan.level_ids and not accrual_plan.level_ids[0].frequency == 'hourly'
            ):
                allocation.employee_id = employees[0]._origin
            else:
                allocation.employee_id = False
            allocation.multi_employee = len(employees) > 1

Back to entity