What is the best way to restrict button access on doctype like Issue

We would like to restrict access to “Close” button and while there are 2 options

  1. Custom script
  2. Python hook

What is the recommended approach to restrict access to button access on doctype e.g. “Close” on Issue

Hi
You can restrict access via python hook.

Hi @shraddha,
could you please elaborate? We have a similar use case, where we would like to restrict access to “Cancel” on sales order based on the current date: if posting date == curdate → allow cancel, otherwise, don’t… Any code snippets?

Hi @lasalesi,
Just refer following links

https://frappe.io/docs/user/en/guides/basics/hooks

Example -

erpnext hooks.py

validate method in employee

https://github.com/frappe/erpnext/blob/develop/erpnext/hr/doctype/employee/employee.py#L214-L219

1 Like