Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

57 righe
2.1 KiB

  1. # Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
  2. #
  3. # MIT License (MIT)
  4. #
  5. # Permission is hereby granted, free of charge, to any person obtaining a
  6. # copy of this software and associated documentation files (the "Software"),
  7. # to deal in the Software without restriction, including without limitation
  8. # the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. # and/or sell copies of the Software, and to permit persons to whom the
  10. # Software is furnished to do so, subject to the following conditions:
  11. #
  12. # The above copyright notice and this permission notice shall be included in
  13. # all copies or substantial portions of the Software.
  14. #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  16. # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  17. # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  18. # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
  19. # CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  20. # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. #
  22. from __future__ import unicode_literals
  23. import webnotes
  24. @webnotes.whitelist()
  25. def savedocs():
  26. """save / submit / cancel / update doclist"""
  27. try:
  28. from webnotes.model.wrapper import ModelWrapper
  29. form = webnotes.form_dict
  30. doclist = ModelWrapper()
  31. doclist.from_compressed(form.get('docs'), form.get('docname'))
  32. # action
  33. action = form.get('action')
  34. if action=='Update': action='update_after_submit'
  35. getattr(doclist, action.lower())()
  36. # update recent documents
  37. webnotes.user.update_recent(doclist.doc.doctype, doclist.doc.name)
  38. # send updated docs
  39. webnotes.response['saved'] = '1'
  40. webnotes.response['main_doc_name'] = doclist.doc.name
  41. webnotes.response['doctype'] = doclist.doc.doctype
  42. webnotes.response['docname'] = doclist.doc.name
  43. webnotes.response['docs'] = [doclist.doc] + doclist.children
  44. except Exception, e:
  45. webnotes.msgprint('Did not save')
  46. webnotes.errprint(webnotes.utils.getTraceback())
  47. raise e