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

Module: Employees Shifts

Entity: hr.employee.base

Compute Method: _compute_current_shift_id

Inputs Method Outputs
"""Current shift for a given employee if any"""
today = fields.Date.today()
now = fields.Datetime.now()
min_time = fields.datetime.combine(today, now.min.time())
max_time = fields.datetime.combine(today, now.max.time())
for employee in self:
            employee.current_shift_id = employee._shift_of_date(min_time, max_time)

Back to entity