blob: 1e2c5f5cc27591c92c836d4095b4b2c03ebbd954 [file] [log] [blame]
Anand Doshi3245a152012-10-01 11:35:49 +05301from __future__ import unicode_literals
Anand Doshi5f76ceb2012-09-24 15:41:41 +05302import webnotes
3from webnotes.model.code import get_obj
4from webnotes.model.doc import addchild
5
6def execute():
7 existing = webnotes.conn.sql("""select name from `tabDocPerm`
8 where permlevel=0 and parent='Event' and role='System Manager'
9 and cancel=1""")
10 if not existing:
11 ev_obj = get_obj("DocType", "Event", with_children=1)
12 ch = addchild(ev_obj.doc, "permissions", "DocPerm")
13 ch.permlevel = 0
14 ch.role = 'System Manager'
15 ch.read = ch.write = ch.create = ch.cancel = 1
16 ch.save()