Browse Source

Update comments on rename

version-14
Anand Doshi 11 years ago
parent
commit
96d032ca12
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      frappe/model/rename_doc.py

+ 5
- 0
frappe/model/rename_doc.py View File

@@ -38,6 +38,7 @@ def rename_doc(doctype, old, new, force=False, merge=False, ignore_permissions=F
if doctype=='DocType': if doctype=='DocType':
rename_doctype(doctype, old, new, force) rename_doctype(doctype, old, new, force)


update_comments(doctype, old, new, force)
update_attachments(doctype, old, new) update_attachments(doctype, old, new)


if merge: 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""", frappe.db.sql("""update tabComment set comment_doctype=%s where comment_doctype=%s""",
(new, old)) (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): def update_child_docs(old, new, meta):
# update "parent" # update "parent"
for df in meta.get_table_fields(): for df in meta.get_table_fields():


Loading…
Cancel
Save