Created
January 22, 2013 09:38
-
-
Save rmehta/4593354 to your computer and use it in GitHub Desktop.
Update multiple doctypes (for cleanup)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webnotes | |
def do(): | |
webnotes.connect() | |
for name in webnotes.conn.sql("""select name from tabDocType"""): | |
doctype = webnotes.model_wrapper("DocType", name[0]) | |
changed = False | |
if doctype.doclist.get({"doctype":"DocPerm", "permlevel":1}): | |
doctype.doclist.remove_items({"doctype":"DocPerm", "permlevel":1}) | |
print doctype.doc.name | |
doctype.save() | |
webnotes.conn.commit() | |
if __name__=="__main__": | |
do() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment