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

Module: Attendances

Entity: hr.employee

Compute Method: _compute_last_attendance_id

Inputs Method Outputs
current_datetime = fields.Datetime.now()
for employee in self:
            employee.last_attendance_id = self.env['hr.attendance'].search([
                ('employee_id', 'in', employee.ids),
                ('check_in', '<=', current_datetime),
            ], order="check_in desc", limit=1)

Back to entity