From 045b2877b7c85b6881cc0dea58f5c3873cd016f1 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 8 Nov 2017 14:57:03 +0530 Subject: [PATCH] [fix] remove warehouse from Stock Settings if warehouse wont exists (#11487) --- erpnext/patches.txt | 1 + .../remove_non_existing_warehouse_from_stock_settings.py | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 erpnext/patches/v9_0/remove_non_existing_warehouse_from_stock_settings.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 486cd7cbed..220250b131 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -456,3 +456,4 @@ erpnext.patches.v9_0.set_variant_item_description erpnext.patches.v9_0.set_uoms_in_variant_field erpnext.patches.v9_0.copy_old_fees_field_data erpnext.patches.v9_0.set_pos_profile_name +erpnext.patches.v9_0.remove_non_existing_warehouse_from_stock_settings \ No newline at end of file diff --git a/erpnext/patches/v9_0/remove_non_existing_warehouse_from_stock_settings.py b/erpnext/patches/v9_0/remove_non_existing_warehouse_from_stock_settings.py new file mode 100644 index 0000000000..33dc5192d1 --- /dev/null +++ b/erpnext/patches/v9_0/remove_non_existing_warehouse_from_stock_settings.py @@ -0,0 +1,7 @@ +import frappe + +def execute(): + default_warehouse = frappe.db.get_value("Stock Settings", None, "default_warehouse") + if default_warehouse: + if not frappe.db.get_value("Warehouse", {"name": default_warehouse}): + frappe.db.set_value("Stock Settings", None, "default_warehouse", "") \ No newline at end of file