blob: ad965e55570a160e0315d6c9651ac85da0c8e4c1 [file] [log] [blame]
Rushabh Mehtae67d1fb2013-08-05 14:59:54 +05301# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
2# License: GNU General Public License v3. See license.txt
3
Anand Doshi3245a152012-10-01 11:35:49 +05304from __future__ import unicode_literals
Anand Doshi5f76ceb2012-09-24 15:41:41 +05305import webnotes
6from webnotes.model.code import get_obj
7from webnotes.model.doc import addchild
8
9def execute():
10 existing = webnotes.conn.sql("""select name from `tabDocPerm`
11 where permlevel=0 and parent='Event' and role='System Manager'
12 and cancel=1""")
13 if not existing:
14 ev_obj = get_obj("DocType", "Event", with_children=1)
15 ch = addchild(ev_obj.doc, "permissions", "DocPerm")
16 ch.permlevel = 0
17 ch.role = 'System Manager'
18 ch.read = ch.write = ch.create = ch.cancel = 1
19 ch.save()