Hide / Remove Edit in Action button

Hi All,

Can you point me to the right direction on how to hide Edit and Assign in Action button, if possible to remove or hide using Client Script or a server script. I dont want user to edit field that was submitted.

Please see attached

edit_action

Thanks

Hello guys any ideas?

Please clarify your requirement. Submitted fields are uneditable in List view by default. If you tried to do it, an error will be thrown.

When you select record In list view on Employee Checkin Sir Under Action button Need to hide Edit.
thanks for the response

To achieve this, create a file named employee_checkin_list.js in custom_app/custom_app/public/js directory and add a hook in your custom app’s hooks.py for the list JS file.
doctype_list_js = {"Employee Checkin": "public/js/employee_checkin_list.js"}

Inside the employee_checkin_list.js, include the below code

frappe.listview_settings['Employee Checkin'].onload = function(listview) {
		listview.page.actions.find('[data-label="Edit"],[data-label="Assign To"]').parent().parent().remove()
};

Note: This method would still allow the user to edit those fields in Form View or from Developer Tools

4 Likes

Sir Thank you for you kind, can be done this on Client Script or a server?

I can find custom_app/custom_app/public/js

Note: dont have custom application. Only on Employee Checkin doctype sir

Client Script will not work in list view, so you have to create a custom app to achieve this. You can also directly edit the ERPNext source code but this is not upgrade safe. If you don’t want to create a custom app, create a new file named employee_checkin_list.js under the directory erpnext/erpnext/hr/doctype/employee_checkin/ and include the code I posted above.

and where did I put this sir?

doctype_list_js = {“Employee Checkin”: “public/js/employee_checkin_list.js”}

Itried this sir but is not working, I don’t is this correct

vi /home/frappe/frappe-bench/apps/erpnext/erpnext/hook.py

doctype_js = {
“Address”: “public/js/address.js”,
“Communication”: “public/js/communication.js”,
“Event”: “public/js/event.js”,
“Newsletter”: “public/js/newsletter.js”
“Employee Checkin”: “/home/frappe/frappe-bench/apps/erpnext/erpnext/hr/doctype/employee_checkin/employee_checkin_list.js”
}

You need to create a custom app first,

1 Like

Thanks for the help really appreciated your inputs