From d119d2ec320e7f7c733253e1850c81c3f209bfd6 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Wed, 16 Aug 2023 17:35:07 +0530 Subject: [PATCH] fix: delete doc without filters --- erpnext/patches/v14_0/delete_education_doctypes.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v14_0/delete_education_doctypes.py b/erpnext/patches/v14_0/delete_education_doctypes.py index 24b9fa1d71..468c2fda32 100644 --- a/erpnext/patches/v14_0/delete_education_doctypes.py +++ b/erpnext/patches/v14_0/delete_education_doctypes.py @@ -44,11 +44,14 @@ def execute(): doctypes = frappe.get_all("DocType", {"module": "education", "custom": 0}, pluck="name") for doctype in doctypes: - frappe.delete_doc( - "Portal Menu Item", {"reference_doctype": doctype}, ignore_missing=True, force=True - ) frappe.delete_doc("DocType", doctype, ignore_missing=True) + portal_menu_items = frappe.get_all( + "Portal Menu Item", {"reference_doctype": ("in", doctypes)}, pluck="name" + ) + for menu_item in portal_menu_items: + frappe.delete_doc("Portal Menu Item", menu_item, ignore_missing=True, force=True) + frappe.delete_doc("Module Def", "Education", ignore_missing=True, force=True) click.secho(