2013-08-05 09:29:54 +00:00
|
|
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
2013-01-23 10:31:35 +00:00
|
|
|
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])
|
|
|
|
|
|
|
|
|
2013-02-18 12:54:28 +00:00
|
|
|
doctype = webnotes.bean("DocType", dt[0])
|
2013-01-23 10:31:35 +00:00
|
|
|
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`
|
2013-01-23 10:40:15 +00:00
|
|
|
where parent = %s and permlevel = %s""", (dt[0], pl))
|