'Links the attendance to the corresponding sheet'

@api.depends('employee_id', 'check_in', 'check_out', 'sheet_id_computed.date_to', 'sheet_id_computed.date_from', 'sheet_id_computed.employee_id')
def _compute_sheet(self):

    for attendance in self:
        corresponding_sheet = self.env['hr_timesheet_sheet.sheet'].search([('date_to', '>=', attendance.check_in), ('date_from', '<=', attendance.check_in), ('employee_id', '=', attendance.employee_id.id), ('state', 'in', ['draft', 'new'])], limit=1)
        if corresponding_sheet:
            attendance.sheet_id_computed = corresponding_sheet[0]
            attendance.sheet_id = corresponding_sheet[0]
