Show form view instead of list view when only one result found?
Is there a way to load directly the form view of the first item of a resultset if there is only one item in the results list?
Our users often enters the exactly number/name for a product, order etc. Every time they get a list_view with all the matching results which are in fact just one. Then they have to click this item to get to the form_view.
Is there a way to directly open the form_view for the first matching item if there is only one item in resultlist? Maybe this option can be triggered when executing the search with a SHIFT + ENTER to indicate they want to get to the form directly.
My suggestion is to hook into the search_read result workflow (in JS), check the number of resulted items and modify the url (id, model, view_type) to load the form view if there is only one item.I've tested it manually to change the url from whatever page I am at the moment and it worked so far.
Is there a better way to do so? Are there any things I'm missing our should respect when doing so to avoid unexpected behaviours?
I'm thankful for any advise, thoughts and suggestions! :)