def reset_perms(): frappe.connect() for d in frappe.db.sql_list("""select name from `tabDocType` where ifnull(istable, 0)=0 and ifnull(custom, 0)=0"""): frappe.clear_cache(doctype=d) frappe.reset_perms(d) frappe.destroy()
def execute(): for doctype in ("About Us Settings", "Accounts Settings", "Activity Type", "Blog Category", "Blog Settings", "Blogger", "Branch", "Brand", "Buying Settings", "Comment", "Communication", "Company", "Contact Us Settings", "Country", "Currency", "Currency Exchange", "Deduction Type", "Department", "Designation", "Earning Type", "Event", "Feed", "File Data", "Fiscal Year", "HR Settings", "Industry Type", "Jobs Email Settings", "Leave Type", "Letter Head", "Mode of Payment", "Module Def", "Naming Series", "POS Setting", "Print Heading", "Report", "Role", "Sales Email Settings", "Selling Settings", "Stock Settings", "Supplier Type", "UOM"): try: frappe.reset_perms(doctype) except: print "Error resetting perms for", doctype raise
def reset(doctype): frappe.only_for("System Manager") frappe.reset_perms(doctype) clear_doctype_cache(doctype)