From 96d032ca121f74e9c2b7e10b4c6a01cbb77db109 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 30 Jun 2014 13:01:46 +0530 Subject: [PATCH] Update comments on rename --- frappe/model/rename_doc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frappe/model/rename_doc.py b/frappe/model/rename_doc.py index b8a4237da8..eff5df6830 100644 --- a/frappe/model/rename_doc.py +++ b/frappe/model/rename_doc.py @@ -38,6 +38,7 @@ def rename_doc(doctype, old, new, force=False, merge=False, ignore_permissions=F if doctype=='DocType': rename_doctype(doctype, old, new, force) + update_comments(doctype, old, new, force) update_attachments(doctype, old, new) if merge: @@ -111,6 +112,10 @@ def rename_doctype(doctype, old, new, force=False): frappe.db.sql("""update tabComment set comment_doctype=%s where comment_doctype=%s""", (new, old)) +def update_comments(doctype, old, new, force=False): + frappe.db.sql("""update `tabComment` set comment_docname=%s + where comment_doctype=%s and comment_docname=%s""", (new, doctype, old)) + def update_child_docs(old, new, meta): # update "parent" for df in meta.get_table_fields():