patch: move data from crm note to fcrm note
This commit is contained in:
parent
8f05d76f9e
commit
e3ff8657ef
@ -1,7 +1,7 @@
|
||||
[pre_model_sync]
|
||||
# Patches added in this section will be executed before doctypes are migrated
|
||||
# Read docs to understand patches: https://frappeframework.com/docs/v14/user/en/database-migrations
|
||||
crm.patches.v1_0.rename_crm_note_to_fcrm_note
|
||||
crm.patches.v1_0.rename_crm_note_to_fcrm_note #also move data from crm_note to fcrm_note
|
||||
|
||||
[post_model_sync]
|
||||
# Patches added in this section will be executed after doctypes are migrated
|
||||
|
||||
@ -10,4 +10,20 @@ def execute():
|
||||
rename_doc("DocType", "CRM Note", "FCRM Note")
|
||||
frappe.flags.ignore_route_conflict_validation = False
|
||||
|
||||
frappe.reload_doctype("FCRM Note", force=True)
|
||||
frappe.reload_doctype("FCRM Note", force=True)
|
||||
|
||||
notes = frappe.db.sql("SELECT * FROM `tabCRM Note`", as_dict=True)
|
||||
if notes:
|
||||
for note in notes:
|
||||
doc = frappe.get_doc({
|
||||
"doctype": "FCRM Note",
|
||||
"creation": note.get("creation"),
|
||||
"modified": note.get("modified"),
|
||||
"modified_by": note.get("modified_by"),
|
||||
"owner": note.get("owner"),
|
||||
"title": note.get("title"),
|
||||
"content": note.get("content"),
|
||||
"reference_doctype": note.get("reference_doctype"),
|
||||
"reference_docname": note.get("reference_docname"),
|
||||
})
|
||||
doc.db_insert()
|
||||
Loading…
x
Reference in New Issue
Block a user