diff --git a/frappe/patches/v12_0/move_email_and_phone_to_child_table.py b/frappe/patches/v12_0/move_email_and_phone_to_child_table.py index 4388d3c849..12680609d5 100644 --- a/frappe/patches/v12_0/move_email_and_phone_to_child_table.py +++ b/frappe/patches/v12_0/move_email_and_phone_to_child_table.py @@ -1,6 +1,10 @@ import frappe def execute(): + frappe.reload_doc("contacts", "doctype", "contact_email") + frappe.reload_doc("contacts", "doctype", "contact_phone") + frappe.reload_doc("contacts", "doctype", "contact") + contact_details = frappe.db.sql(""" SELECT `name`, `email_id`, `phone`, `mobile_no`, `modified_by`, `creation`, `modified` @@ -10,10 +14,6 @@ def execute(): and `tabContact Email`.email_id=`tabContact`.email_id) """, as_dict=True) - frappe.reload_doc("contacts", "doctype", "contact_email") - frappe.reload_doc("contacts", "doctype", "contact_phone") - frappe.reload_doc("contacts", "doctype", "contact") - email_values = [] phone_values = [] for count, contact_detail in enumerate(contact_details):