You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
847 B

  1. import webnotes
  2. @webnotes.whitelist()
  3. def savedocs():
  4. """save / submit / cancel / update doclist"""
  5. try:
  6. from webnotes.model.doclist import DocList
  7. form = webnotes.form_dict
  8. doclist = DocList()
  9. doclist.from_compressed(form.get('docs'), form.get('docname'))
  10. # action
  11. action = form.get('action')
  12. if action=='Update': action='update_after_submit'
  13. getattr(doclist, action.lower())()
  14. # update recent documents
  15. webnotes.user.update_recent(doclist.doc.doctype, doclist.doc.name)
  16. # send updated docs
  17. webnotes.response['saved'] = '1'
  18. webnotes.response['main_doc_name'] = doclist.doc.name
  19. webnotes.response['docname'] = doclist.doc.name
  20. webnotes.response['docs'] = [doclist.doc] + doclist.children
  21. except Exception, e:
  22. webnotes.msgprint('Did not save')
  23. webnotes.errprint(webnotes.utils.getTraceback())
  24. raise e