Skip to content

Instantly share code, notes, and snippets.

@rmehta
Created January 22, 2013 09:38
Show Gist options
  • Save rmehta/4593354 to your computer and use it in GitHub Desktop.
Save rmehta/4593354 to your computer and use it in GitHub Desktop.
Update multiple doctypes (for cleanup)
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