removed unwanted permission

This commit is contained in:
Nabin Hait 2013-01-23 16:01:35 +05:30
parent 3ac8e59cb8
commit a8454e2764
2 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,14 @@
def execute():
import webnotes
for dt in webnotes.conn.sql("""select name, issingle from tabDocType"""):
if dt[1]:
webnotes.conn.sql("""update tabDocPerm set report = 0 where parent = %s""", dt[0])
doctype = webnotes.model_wrapper("DocType", dt[0])
for pl in [1, 2, 3]:
if not doctype.doclist.get({"doctype": "DocField", "permlevel": pl}):
if doctype.doclist.get({"doctype":"DocPerm", "permlevel":pl}):
webnotes.conn.sql("""delete from `tabDocPerm`
where parent = %s and permlevel = %s""", (dt[0], pl))
print doctype.doc.name

View File

@ -155,4 +155,5 @@ patch_list = [
"patches.january_2013.purchase_price_list",
"execute:webnotes.reload_doc('accounts','Print Format','Payment Receipt Voucher')",
"patches.january_2013.update_fraction_for_usd",
"patches.january_2013.remove_unwanted_permission",
]