Merge branch 'master' of github.com:webnotes/erpnext into unicode

This commit is contained in:
Anand Doshi 2012-09-10 12:04:30 +05:30
commit 21e8447e6c
2 changed files with 25 additions and 0 deletions

View File

@ -573,4 +573,8 @@ patch_list = [
'patch_module': 'patches.september_2012',
'patch_file': 'stock_report_permissions_for_accounts',
},
{
'patch_module': 'patches.september_2012',
'patch_file': 'communication_delete_permission',
},
]

View File

@ -0,0 +1,21 @@
def execute():
import webnotes
from webnotes.model.doc import addchild
from webnotes.model.code import get_obj
existing = webnotes.conn.sql("""select role, name from `tabDocPerm`
where permlevel=0 and parent='Communication'""")
for role in ("Support Manager", "System Manager"):
if role not in map(lambda x: x[0], existing):
doctype_obj = get_obj("DocType", "Communication", with_children=1)
ch = addchild(doctype_obj.doc, "permissions", "DocPerm")
ch.permlevel = 0
ch.role = role
ch.read = 1
ch.write = 1
ch.create = 1
ch.cancel = 1
ch.save()
else:
webnotes.conn.set_value("DocPerm", dict(existing).get(role), "cancel", 1)