From b3e3ec7b863e26a3bcad6826da5ebbc63003026c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 1 Aug 2016 12:15:55 +0530 Subject: [PATCH] [minor] fix for rename_doc --- frappe/model/rename_doc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/model/rename_doc.py b/frappe/model/rename_doc.py index a3bf6f6963..49d792f0fb 100644 --- a/frappe/model/rename_doc.py +++ b/frappe/model/rename_doc.py @@ -89,12 +89,16 @@ def rename_parent_and_child(doctype, old, new, meta): def validate_rename(doctype, new, meta, merge, force, ignore_permissions): # 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 COLLATE utf8mb4_unicode_ci for update".format(doctype=frappe.db.escape(doctype)), new) + exists = frappe.db.sql("select name from `tab{doctype}` where name=%s for update".format(doctype=frappe.db.escape(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) + if exists and exists != new: + # for fixing case, accents + exists = None + if (not merge) and exists: frappe.msgprint(_("Another {0} with name {1} exists, select another name").format(doctype, new), raise_exception=1)