fix: ignore flags in frappe.client.bulk_update
This commit is contained in:
parent
51ce9f5832
commit
9df93d341b
1 changed files with 6 additions and 7 deletions
|
|
@ -276,18 +276,17 @@ def bulk_update(docs):
|
|||
docs = json.loads(docs)
|
||||
failed_docs = []
|
||||
for doc in docs:
|
||||
doc.pop("flags", None)
|
||||
try:
|
||||
ddoc = {key: val for key, val in doc.items() if key not in ['doctype', 'docname']}
|
||||
doctype = doc['doctype']
|
||||
docname = doc['docname']
|
||||
doc = frappe.get_doc(doctype, docname)
|
||||
doc.update(ddoc)
|
||||
doc.save()
|
||||
except:
|
||||
existing_doc = frappe.get_doc(doc.pop("doctype"), doc.pop("docname"))
|
||||
existing_doc.update(doc)
|
||||
existing_doc.save()
|
||||
except Exception:
|
||||
failed_docs.append({
|
||||
'doc': doc,
|
||||
'exc': frappe.utils.get_traceback()
|
||||
})
|
||||
|
||||
return {'failed_docs': failed_docs}
|
||||
|
||||
@frappe.whitelist()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue