fix: prevent deletion if document is locked
This commit is contained in:
parent
e810fb7eca
commit
fc5ce044e6
1 changed files with 11 additions and 1 deletions
|
|
@ -104,7 +104,17 @@ def delete_doc(
|
|||
pass
|
||||
|
||||
else:
|
||||
doc = frappe.get_doc(doctype, name, for_update=True)
|
||||
# Lock the doc without waiting
|
||||
try:
|
||||
frappe.db.get_value(doctype, name, for_update=True, wait=False)
|
||||
except frappe.QueryTimeoutError:
|
||||
frappe.throw(
|
||||
_(
|
||||
"This document can not be deleted right now as it's being modified by another user. Please try again after some time."
|
||||
),
|
||||
exc=frappe.QueryTimeoutError,
|
||||
)
|
||||
doc = frappe.get_doc(doctype, name)
|
||||
|
||||
if not for_reload:
|
||||
update_flags(doc, flags, ignore_permissions)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue