From f7b5b7beb4efb24e902929db0362c1ba28829f0f Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Sun, 7 Oct 2018 13:08:00 +0530 Subject: [PATCH] fix: make location from warehouse patch - optimization by preventing patch execution if Asset doesn't exist --- erpnext/patches/v11_0/make_location_from_warehouse.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/patches/v11_0/make_location_from_warehouse.py b/erpnext/patches/v11_0/make_location_from_warehouse.py index b5b2e17c3b..a307e8c365 100644 --- a/erpnext/patches/v11_0/make_location_from_warehouse.py +++ b/erpnext/patches/v11_0/make_location_from_warehouse.py @@ -6,6 +6,7 @@ import frappe from frappe.utils.nestedset import rebuild_tree def execute(): + if not frappe.db.get_value('Asset', {'docstatus': ('<', 2) }, 'name'): return frappe.reload_doc('assets', 'doctype', 'location') frappe.reload_doc('stock', 'doctype', 'warehouse')