[fix] remove warehouse from Stock Settings if warehouse wont exists (#11487)

This commit is contained in:
Saurabh 2017-11-08 14:57:03 +05:30 committed by Nabin Hait
parent 148b62a206
commit 045b2877b7
2 changed files with 8 additions and 0 deletions

View File

@ -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.set_uoms_in_variant_field
erpnext.patches.v9_0.copy_old_fees_field_data erpnext.patches.v9_0.copy_old_fees_field_data
erpnext.patches.v9_0.set_pos_profile_name erpnext.patches.v9_0.set_pos_profile_name
erpnext.patches.v9_0.remove_non_existing_warehouse_from_stock_settings

View File

@ -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", "")