Bypass Listview for Employee role


For employee role, if any employee opens employee doctype then it shows them only their name in listview and then the detailed form.

What I want is for employee roles only, if they open employee doctype, it redirects/routes them to the details page, bypassing the listview. Is there any client script? I was using the below script and it redirects them but getting the error “undefined” for roles other than the employee for eg. Admin and HR

And also if I click back then also it is continuously redirecting me to the same page.


frappe.listview_settings['Employee'] = {
  get_form_link: function(doc) {
        frappe.set_route("/app/employee/" +;