ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

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


#1

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


#2

Hi
You can restrict access via python hook.


#3

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?


#4

Hi @lasalesi,
Just refer following links

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

Example -

erpnext hooks.py


validate method in employee