@frappe.whitelist()
def bulk_update(docs):
 docs = json.loads(docs)
 failed_docs = []
 for doc in docs:
  try:
   ddoc = {key: val for (key, val) in doc.iteritems() if (key not in [u'doctype', u'docname'])}
   doctype = doc[u'doctype']
   docname = doc[u'docname']
   doc = frappe.get_doc(doctype, docname)
   doc.update(ddoc)
   doc.save()
  except:
   failed_docs.append({u'doc': doc, u'exc': frappe.utils.get_traceback()})
 return {u'failed_docs': failed_docs}

@ frappe . whitelist ( ) def bulk_update ( docs ) : docs = json . loads ( docs ) failed_docs = [ ] for doc in docs : try : ddoc = { key : val for ( key , val ) in doc . iteritems ( ) if ( key not in [ u'doctype' , u'docname' ] ) } doctype = doc [ u'doctype' ] docname = doc [ u'docname' ] doc = frappe . get_doc ( doctype , docname ) doc . update ( ddoc ) doc . save ( ) except : failed_docs . append ( { u'doc' : doc , u'exc' : frappe . utils . get_traceback ( ) } ) return { u'failed_docs' : failed_docs }
bulk update documents .