fix: lock the doc before deleting

Locking only prevents this kinda race conditions:
- User A deletes doc
- User B modifies doc so that it's not deletable anymore.
This commit is contained in:
Ankush Menat 2024-02-29 16:22:02 +05:30
parent b044ffedf1
commit 8f00aae160

View file

@ -104,7 +104,7 @@ def delete_doc(
pass
else:
doc = frappe.get_doc(doctype, name)
doc = frappe.get_doc(doctype, name, for_update=True)
if not for_reload:
update_flags(doc, flags, ignore_permissions)