Anand Doshi | 3245a15 | 2012-10-01 11:35:49 +0530 | [diff] [blame] | 1 | from __future__ import unicode_literals |
Anand Doshi | 5f76ceb | 2012-09-24 15:41:41 +0530 | [diff] [blame] | 2 | import webnotes |
| 3 | from webnotes.model.code import get_obj |
| 4 | from webnotes.model.doc import addchild |
| 5 | |
| 6 | def 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() |