Warehouse patch fix
diff --git a/erpnext/patches/v7_0/create_warehouse_nestedset.py b/erpnext/patches/v7_0/create_warehouse_nestedset.py
index 0fa1756..34384ef 100644
--- a/erpnext/patches/v7_0/create_warehouse_nestedset.py
+++ b/erpnext/patches/v7_0/create_warehouse_nestedset.py
@@ -47,6 +47,9 @@
 
 def make_warehouse_nestedset(company=None):
 	validate_parent_account_for_warehouse(company)
+	stock_account_group = get_stock_account_group(company.name)
+	if not stock_account_group:
+		return
 
 	if company:
 		warehouse_group = "{0} - {1}".format(_("All Warehouses"), company.abbr)
@@ -56,11 +59,11 @@
 		ignore_mandatory = True
 
 	if not frappe.db.get_value("Warehouse", warehouse_group):
-		create_default_warehouse_group(company, ignore_mandatory)
+		create_default_warehouse_group(company, stock_account_group, ignore_mandatory)
 
 	set_parent_to_warehouse(warehouse_group, company)
 	if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
-		set_parent_to_warehouse_acount(company)
+		set_parent_to_warehouse_account(company)
 
 def validate_parent_account_for_warehouse(company=None):
 	if not company:
@@ -78,13 +81,14 @@
 			if current_parent_accounts_for_warehouse:
 				frappe.db.set_value("Account", current_parent_accounts_for_warehouse[0][0], "account_type", "Stock")
 
-def create_default_warehouse_group(company=None, ignore_mandatory=False):
+def create_default_warehouse_group(company=None, stock_account_group=None, ignore_mandatory=False):
 	wh = frappe.get_doc({
 		"doctype": "Warehouse",
 		"warehouse_name": _("All Warehouses"),
 		"is_group": 1,
 		"company": company.name if company else "",
-		"parent_warehouse": ""
+		"parent_warehouse": "",
+		"create_account_under": stock_account_group
 	})
 
 	if ignore_mandatory:
@@ -99,7 +103,7 @@
 
 	rebuild_tree("Warehouse", "parent_warehouse")
 
-def set_parent_to_warehouse_acount(company):
+def set_parent_to_warehouse_account(company):
 	frappe.db.sql(""" update tabAccount set parent_account = %s
 		where is_group = 0 and account_type = "Warehouse"
 		and (warehouse is not null or warehouse != '') and company = %s
@@ -109,3 +113,13 @@
 
 def set_company_to_warehouse(company):
 	frappe.db.sql("update tabWahouse set company=%s", company)
+
+def get_stock_account_group(company):
+	stock_account_group = frappe.db.get_all('Account', filters = {'company': company, 'is_group': 1,
+		'account_type': 'Stock', 'root_type': 'Asset'}, limit=1)
+			
+	if not stock_account_group:
+		stock_account_group = frappe.db.get_all('Account', filters = {'company': company, 'is_group': 1,
+				'parent_account': '', 'root_type': 'Asset'}, limit=1)
+
+	return stock_account_group[0].name if stock_account_group else None
\ No newline at end of file
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index c0a385a..938e73c 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -93,12 +93,6 @@
 			if parent_account:
 				frappe.db.set_value("Warehouse", self.name, "create_account_under", parent_account[0][0])
 				self.create_account_under = parent_account[0][0]
-			else:
-				# did not find parent, add it to root Assets
-				# let the user figure.
-				self.create_account_under = frappe.db.get_all('Account',
-					filters = {'company': self.company, 'is_group': 1,
-						'parent_account': '', 'root_type': 'Asset'}, limit=1)[0].name
 		elif frappe.db.get_value("Account", self.create_account_under, "company") != self.company:
 			frappe.throw(_("Warehouse {0}: Parent account {1} does not bolong to the company {2}")
 				.format(self.name, self.create_account_under, self.company))