From 48ed12bdd72d90a0d40be8bca4af6c0db758f658 Mon Sep 17 00:00:00 2001 From: Sanket322 Date: Mon, 14 Oct 2024 12:25:32 +0530 Subject: [PATCH] fix: check for existence of doctype before querying --- erpnext/patches/v15_0/migrate_to_utm_analytics.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/patches/v15_0/migrate_to_utm_analytics.py b/erpnext/patches/v15_0/migrate_to_utm_analytics.py index c8a1d6fc5b4..4385e1ab453 100644 --- a/erpnext/patches/v15_0/migrate_to_utm_analytics.py +++ b/erpnext/patches/v15_0/migrate_to_utm_analytics.py @@ -10,6 +10,8 @@ def execute(): Remove Lead Source doctype and use UTM Source Instead Ensure that for each Campaign, a UTM Campaign is also set """ + if not frappe.db.exists("DocType", "Lead Source") or not frappe.db.exists("DocType", "UTM Source"): + return ls = frappe.qb.DocType("Lead Source") ms = frappe.qb.DocType("UTM Source")