From 18310c240f2e948f8c4149dcb29ff91bc89144a7 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Wed, 12 Sep 2018 17:36:29 +0530 Subject: [PATCH] fix(patch): delete hub documents While deteting the "Data Migratun Plan" docs the patch used to break, since it was linked to docs from "Data Migration Run". Modified the patch to also delete the linked "Data Migration Run" docs. --- erpnext/patches/v10_0/delete_hub_documents.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/patches/v10_0/delete_hub_documents.py b/erpnext/patches/v10_0/delete_hub_documents.py index 9e293d3d57..6dcfec7ca8 100644 --- a/erpnext/patches/v10_0/delete_hub_documents.py +++ b/erpnext/patches/v10_0/delete_hub_documents.py @@ -12,4 +12,7 @@ def execute(): plan_doc = frappe.get_doc("Data Migration Plan", plan.name) for m in plan_doc.get("mappings"): frappe.delete_doc("Data Migration Mapping", m.mapping, force=True) + docs = frappe.get_all("Data Migration Run", filters={"data_migration_plan": plan.name}) + for doc in docs: + frappe.delete_doc("Data Migration Run", doc.name) frappe.delete_doc("Data Migration Plan", plan.name)