diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 486cd7cbed2..220250b1314 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 00000000000..33dc5192d1b --- /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