2013-11-20 07:29:58 +00:00
|
|
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
2013-08-05 09:29:54 +00:00
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
2012-10-01 06:05:49 +00:00
|
|
|
from __future__ import unicode_literals
|
2012-09-24 10:11:41 +00:00
|
|
|
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()
|