Update __init__.py
diff --git a/erpnext/stock/__init__.py b/erpnext/stock/__init__.py
index 331472a..9895b5a 100644
--- a/erpnext/stock/__init__.py
+++ b/erpnext/stock/__init__.py
@@ -45,10 +45,10 @@
 
 			account = account[0][0] if account else None
 
-	if not account:
+	if not account and warehouse.company:
 		account = get_company_default_inventory_account(warehouse.company)
 
 	return account
 	
 def get_company_default_inventory_account(company):
-	return frappe.get_cached_value('Company',  company,  'default_inventory_account')
\ No newline at end of file
+	return frappe.get_cached_value('Company',  company,  'default_inventory_account')