patch: move data from crm note to fcrm note
This commit is contained in:
parent
e3ff8657ef
commit
980defb368
@ -1,7 +1,7 @@
|
|||||||
[pre_model_sync]
|
[pre_model_sync]
|
||||||
# Patches added in this section will be executed before doctypes are migrated
|
# 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
|
# Read docs to understand patches: https://frappeframework.com/docs/v14/user/en/database-migrations
|
||||||
crm.patches.v1_0.rename_crm_note_to_fcrm_note #also move data from crm_note to fcrm_note
|
crm.patches.v1_0.move_crm_note_data_to_fcrm_note
|
||||||
|
|
||||||
[post_model_sync]
|
[post_model_sync]
|
||||||
# Patches added in this section will be executed after doctypes are migrated
|
# Patches added in this section will be executed after doctypes are migrated
|
||||||
|
|||||||
@ -3,15 +3,17 @@ from frappe.model.rename_doc import rename_doc
|
|||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
if frappe.db.exists("DocType", "FCRM Note"):
|
|
||||||
|
if not frappe.db.exists("DocType", "FCRM Note"):
|
||||||
|
frappe.flags.ignore_route_conflict_validation = True
|
||||||
|
rename_doc("DocType", "CRM Note", "FCRM Note")
|
||||||
|
frappe.flags.ignore_route_conflict_validation = False
|
||||||
|
|
||||||
|
frappe.reload_doctype("FCRM Note", force=True)
|
||||||
|
|
||||||
|
if frappe.db.exists("DocType", "FCRM Note") and frappe.db.count("FCRM Note") > 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
frappe.flags.ignore_route_conflict_validation = True
|
|
||||||
rename_doc("DocType", "CRM Note", "FCRM Note")
|
|
||||||
frappe.flags.ignore_route_conflict_validation = False
|
|
||||||
|
|
||||||
frappe.reload_doctype("FCRM Note", force=True)
|
|
||||||
|
|
||||||
notes = frappe.db.sql("SELECT * FROM `tabCRM Note`", as_dict=True)
|
notes = frappe.db.sql("SELECT * FROM `tabCRM Note`", as_dict=True)
|
||||||
if notes:
|
if notes:
|
||||||
for note in notes:
|
for note in notes:
|
||||||
Loading…
x
Reference in New Issue
Block a user