浏览代码

lock old row before rename

version-14
Anand Doshi 10 年前
父节点
当前提交
74b335ce29
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. +3
    -1
      frappe/model/rename_doc.py

+ 3
- 1
frappe/model/rename_doc.py 查看文件

@@ -82,7 +82,9 @@ def rename_parent_and_child(doctype, old, new, meta):
update_child_docs(old, new, meta)

def validate_rename(doctype, new, meta, merge, force, ignore_permissions):
exists = frappe.db.get_value(doctype, new)
# using for update so that it gets locked and someone else cannot edit it while this rename is going on!
exists = frappe.db.sql("select name from `tab{doctype}` where name=%s for update".format(doctype=doctype), new)
exists = exists[0][0] if exists else None

if merge and not exists:
frappe.msgprint(_("{0} {1} does not exist, select a new target to merge").format(doctype, new), raise_exception=1)


正在加载...
取消
保存