diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 3e14469ffa1..e14be4b8146 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -588,6 +588,10 @@ patch_list = [ 'patch_module': 'patches.september_2012', 'patch_file': 'plot_patch', }, + { + 'patch_module': 'patches.september_2012', + 'patch_file': 'event_permission', + }, { 'patch_module': 'patches.september_2012', 'patch_file': 'repost_stock', diff --git a/erpnext/patches/september_2012/event_permission.py b/erpnext/patches/september_2012/event_permission.py new file mode 100644 index 00000000000..2f1a848950c --- /dev/null +++ b/erpnext/patches/september_2012/event_permission.py @@ -0,0 +1,15 @@ +import webnotes +from webnotes.model.code import get_obj +from webnotes.model.doc import addchild + +def execute(): + existing = webnotes.conn.sql("""select name from `tabDocPerm` + where permlevel=0 and parent='Event' and role='System Manager' + and cancel=1""") + if not existing: + ev_obj = get_obj("DocType", "Event", with_children=1) + ch = addchild(ev_obj.doc, "permissions", "DocPerm") + ch.permlevel = 0 + ch.role = 'System Manager' + ch.read = ch.write = ch.create = ch.cancel = 1 + ch.save() \ No newline at end of file