Revert "fix(patch): Reload linked doctypes before renaming dt"
This reverts commit 4e2e8daca9bb9ece93acde85df38a69304fb43a2 because although it fixed it locally, didn't seem to do anything for erpnext CI
This commit is contained in:
parent
4e2e8daca9
commit
ac99c719bc
@ -1,7 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
from frappe.model.rename_doc import get_link_fields
|
||||
|
||||
def execute():
|
||||
if frappe.db.exists('DocType', 'Lab Test') and frappe.db.exists('DocType', 'Lab Test Template'):
|
||||
@ -18,18 +17,9 @@ def execute():
|
||||
frappe.reload_doc('healthcare', 'doctype', 'lab_test_template')
|
||||
|
||||
for old_dt, new_dt in doctypes.items():
|
||||
should_rename = (
|
||||
frappe.db.table_exists(old_dt)
|
||||
and not frappe.db.table_exists(new_dt)
|
||||
)
|
||||
if should_rename:
|
||||
if not frappe.db.table_exists(new_dt) and frappe.db.table_exists(old_dt):
|
||||
frappe.reload_doc('healthcare', 'doctype', frappe.scrub(old_dt))
|
||||
|
||||
linked_doctypes = {x.parent for x in get_link_fields(old_dt)}
|
||||
for linked_doctype in linked_doctypes:
|
||||
frappe.reload_doctype(linked_doctype, force=True)
|
||||
frappe.rename_doc('DocType', old_dt, new_dt, force=True)
|
||||
|
||||
frappe.reload_doc('healthcare', 'doctype', frappe.scrub(new_dt))
|
||||
frappe.delete_doc_if_exists('DocType', old_dt)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user