If you have reference to the field schema, you can set its display CAML to be a link that has an "onclick" event. If you do not have access to the field Schema, then you could use SharePoint Designer and modify the XSL of the list view web part to create the link.
<a href="#" onclick="OnClickIDField('ID Field Text')">ID Field Text</a>
In the onclick event you call a javascript function that you would have to include on the page or in a loaded javascript file that uses REST to find and open the document. It would be easiest to use jquery (add a reference to a jquery version in your master page or the page where the list is displayed: ) to use AJAX to make the rest call.
The REST URL to find a document that contains a string is this:
http://sharepointserverurl/[path to site]/_vti_bin/listdata.svc/[title of Document library]?$select=Name,Path&$filter=substringof('Report',Name)%20eq%20true
The Path property contains the relative path to the document's folder and you would have to append "/" and the Name property to it to get the document URL.
So the OnClickIDField function might look like this:
function OnClickIDField(docID) {
$.ajax({
url: "/_vti_bin/listdata.svc/Documents?$select=Name,Path&$filter=substringof('"
+ docID + "',Name)%20eq%20true",
type: "GET",
headers: { "ACCEPT": "application/json;odata=verbose" },
success: function (data) {
if (data.d.results != undefined && data.d.results.length > 0 && data.d.results[0].Path != undefined) {
window.document.location.href = data.d.results[0].Path + "/" + data.d.results[0].Name;
}
},
error: function (data) {
// error handler
}
});
return false; }
This is works to open document on click of linkToItem