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

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


Example -

erpnext hooks.py

validate method in employee


1 Like