update for default warehouse
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 4789464..4d2e7cc 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -39,7 +39,7 @@
 	update_multi_mode_option(doc, pos_profile)
 	default_print_format = pos_profile.get('print_format') or "Point of Sale"
 	print_template = frappe.db.get_value('Print Format', default_print_format, 'html')
-	items_list = get_items_list(pos_profile)
+	items_list = get_items_list(pos_profile, doc.company)
 	customers = get_customers_list(pos_profile)
 
 	return {
@@ -151,25 +151,26 @@
 		doc.append('taxes', tax)
 
 
-def get_items_list(pos_profile):
-	cond = "1=1"
-	item_groups = []
+def get_items_list(pos_profile, company):
+	cond = ""
+	args_list = [company]
 	if pos_profile.get('item_groups'):
 		# Get items based on the item groups defined in the POS profile
 		for d in pos_profile.get('item_groups'):
-			item_groups.extend([d.name for d in get_child_nodes('Item Group', d.item_group)])
-		cond = "item_group in (%s)" % (', '.join(['%s'] * len(item_groups)))
+			args_list.extend([d.name for d in get_child_nodes('Item Group', d.item_group)])
+		cond = "and i.item_group in (%s)" % (', '.join(['%s'] * len(args_list)))
 
 	return frappe.db.sql("""
 		select
-			name, item_code, item_name, description, item_group, expense_account, has_batch_no,
-			has_serial_no, expense_account, selling_cost_center, stock_uom, image,
-			default_warehouse, is_stock_item, brand
+			i.name, i.item_code, i.item_name, i.description, i.item_group, i.has_batch_no,
+			i.has_serial_no, i.is_stock_item, i.brand, i.stock_uom, i.image,
+			id.expense_account, id.selling_cost_center, id.default_warehouse
 		from
-			tabItem
+			`tabItem` i, `tabItem Default` id
 		where
-			disabled = 0 and has_variants = 0 and is_sales_item = 1 and {cond}
-		""".format(cond=cond), tuple(item_groups), as_dict=1)
+			id.parent = i.name and i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1
+			and id.company = %s {cond}
+		""".format(cond=cond), tuple(args_list), as_dict=1)
 
 
 def get_item_groups(pos_profile):
@@ -531,9 +532,12 @@
 			item_doc.item_code = item.get('item_code')
 			item_doc.item_name = item.get('item_name')
 			item_doc.description = item.get('description')
-			item_doc.default_warehouse = item.get('warehouse')
 			item_doc.stock_uom = item.get('stock_uom')
 			item_doc.item_group = item.get('item_group')
+			item_doc.append('item_defaults', {
+				"company": doc.get("company"),
+				"default_warehouse": item.get('warehouse')
+			})
 			item_doc.save(ignore_permissions=True)
 			frappe.db.commit()
 
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index fa2436d..13baf6f 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -216,8 +216,9 @@
 
 		raw_materials_cost = 0
 		items = list(set([d.item_code for d in bom_items]))
-		item_wh = frappe._dict(frappe.db.sql("""select item_code, default_warehouse
-			from `tabItem` where name in ({0})""".format(", ".join(["%s"] * len(items))), items))
+		item_wh = frappe._dict(frappe.db.sql("""select i.item_code, id.default_warehouse
+			from `tabItem` i, `tabItem Default` id where id.company=%s and i.name in ({0})"""
+			.format(", ".join(["%s"] * len(items))), [self.company] + items))
 
 		for bom_item in bom_items:
 			if self.doctype == "Purchase Order":
diff --git a/erpnext/demo/data/item.json b/erpnext/demo/data/item.json
index 6974b94..461ed42 100644
--- a/erpnext/demo/data/item.json
+++ b/erpnext/demo/data/item.json
@@ -1,7 +1,9 @@
 [
  {
   "default_supplier": "Asiatic Solutions",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "For Upper Bearing",
   "image": "/assets/erpnext_demo/images/disc.png",
   "item_code": "Disc Collars",
@@ -10,7 +12,9 @@
  },
  {
   "default_supplier": "Nan Duskin",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "CAST IRON, MCMASTER PART NO. 3710T13",
   "image": "/assets/erpnext_demo/images/bearing.jpg",
   "item_code": "Bearing Block",
@@ -19,7 +23,9 @@
  },
  {
   "default_supplier": null,
-  "default_warehouse": "Finished Goods",
+  "item_defaults": [{
+      "default_warehouse": "Finished Goods",
+  }],
   "description": "Wind Mill C Series for Commercial Use 18ft",
   "image": "/assets/erpnext_demo/images/wind-turbine-2.png",
   "item_code": "Wind MIll C Series",
@@ -28,7 +34,9 @@
  },
  {
   "default_supplier": null,
-  "default_warehouse": "Finished Goods",
+  "item_defaults": [{
+      "default_warehouse": "Finished Goods",
+  }],
   "description": "Wind Mill A Series for Home Use 9ft",
   "image": "/assets/erpnext_demo/images/wind-turbine.png",
   "item_code": "Wind Mill A Series",
@@ -37,7 +45,9 @@
  },
  {
   "default_supplier": null,
-  "default_warehouse": "Finished Goods",
+  "item_defaults": [{
+      "default_warehouse": "Finished Goods",
+  }],
   "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->",
   "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
   "item_code": "Wind Turbine",
@@ -51,7 +61,9 @@
  },
  {
   "default_supplier": "HomeBase",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "1.5 in. Diameter x 36 in. Mild Steel Tubing",
   "image": null,
   "item_code": "Bearing Pipe",
@@ -60,7 +72,9 @@
  },
  {
   "default_supplier": "New World Realty",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet",
   "image": null,
   "item_code": "Wing Sheet",
@@ -69,7 +83,9 @@
  },
  {
   "default_supplier": "Eagle Hardware",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate",
   "image": null,
   "item_code": "Upper Bearing Plate",
@@ -78,7 +94,9 @@
  },
  {
   "default_supplier": "Asiatic Solutions",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "Bearing Assembly",
   "image": null,
   "item_code": "Bearing Assembly",
@@ -87,7 +105,9 @@
  },
  {
   "default_supplier": "HomeBase",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood",
   "image": null,
   "item_code": "Base Plate",
@@ -97,7 +117,9 @@
  },
  {
   "default_supplier": "Scott Ties",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "N/A",
   "image": null,
   "item_code": "Stand",
@@ -106,7 +128,9 @@
  },
  {
   "default_supplier": "Eagle Hardware",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar",
   "image": null,
   "item_code": "Bearing Collar",
@@ -115,7 +139,9 @@
  },
  {
   "default_supplier": "Eagle Hardware",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "1/4 in. x 6 in. x 6 in. Mild Steel Plate",
   "image": null,
   "item_code": "Base Bearing Plate",
@@ -124,7 +150,9 @@
  },
  {
   "default_supplier": "HomeBase",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing",
   "image": null,
   "item_code": "External Disc",
@@ -133,7 +161,9 @@
  },
  {
   "default_supplier": "Eagle Hardware",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "1.25 in. Diameter x 6 ft. Mild Steel Tubing",
   "image": null,
   "item_code": "Shaft",
@@ -142,7 +172,9 @@
  },
  {
   "default_supplier": "Ks Merchandise",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "1/2 in. x 2 ft. x 4 ft. Pine Plywood",
   "image": null,
   "item_code": "Blade Rib",
@@ -151,7 +183,9 @@
  },
  {
   "default_supplier": "HomeBase",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "For Bearing Collar",
   "image": null,
   "item_code": "Internal Disc",
@@ -160,7 +194,9 @@
  },
  {
   "default_supplier": null,
-  "default_warehouse": "Finished Goods",
+  "item_defaults": [{
+      "default_warehouse": "Finished Goods",
+  }],
   "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Small</p>",
   "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
   "item_code": "Wind Turbine-S",
@@ -177,7 +213,9 @@
  },
  {
   "default_supplier": null,
-  "default_warehouse": "Finished Goods",
+  "item_defaults": [{
+      "default_warehouse": "Finished Goods",
+  }],
   "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Medium</p>",
   "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
   "item_code": "Wind Turbine-M",
@@ -194,7 +232,9 @@
  },
  {
   "default_supplier": null,
-  "default_warehouse": "Finished Goods",
+  "item_defaults": [{
+      "default_warehouse": "Finished Goods",
+  }],
   "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Large</p>",
   "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
   "item_code": "Wind Turbine-L",
@@ -218,7 +258,9 @@
  },
  {
   "default_supplier": "HomeBase",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood",
   "image": null,
   "item_code": "Base Plate Un Painted",
@@ -284,7 +326,9 @@
   "has_batch_no": 1,
   "create_new_batch": 1,
   "valuation_rate": 200,
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+  }],
   "description": "Corrugated Box",
   "item_code": "Corrugated Box",
   "item_name": "Corrugated Box",
diff --git a/erpnext/demo/data/item_education.json b/erpnext/demo/data/item_education.json
index 077fcaa..40e4701 100644
--- a/erpnext/demo/data/item_education.json
+++ b/erpnext/demo/data/item_education.json
@@ -1,63 +1,90 @@
 [
  {
   "default_supplier": "Asiatic Solutions",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "item_code": "Books",
   "item_group": "Raw Material",
   "item_name": "Books"
  },
  {
   "default_supplier": "HomeBase",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "item_code": "Pencil",
   "item_group": "Raw Material",
   "item_name": "Pencil"
  },
  {
   "default_supplier": "New World Realty",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "item_code": "Tables",
   "item_group": "Raw Material",
   "item_name": "Tables"
  },
  {
   "default_supplier": "Eagle Hardware",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "item_code": "Chair",
   "item_group": "Raw Material",
   "item_name": "Chair"
  },
  {
   "default_supplier": "Asiatic Solutions",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "item_code": "Black Board",
   "item_group": "Sub Assemblies",
   "item_name": "Black Board"
  },
  {
   "default_supplier": "HomeBase",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "item_code": "Chalk",
   "item_group": "Raw Material",
   "item_name": "Chalk"
  },
  {
   "default_supplier": "HomeBase",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "item_code": "Notepad",
   "item_group": "Raw Material",
   "item_name": "Notepad"
  },
  {
   "default_supplier": "Ks Merchandise",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "item_code": "Uniform",
   "item_group": "Raw Material",
   "item_name": "Uniform"
  },
  {
   "is_stock_item": 0,
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "description": "Computer",
   "item_code": "Computer",
   "item_name": "Computer",
@@ -65,7 +92,10 @@
  },
  {
   "is_stock_item": 0,
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "description": "Mobile",
   "item_code": "Mobile",
   "item_name": "Mobile",
@@ -73,7 +103,10 @@
  },
  {
   "is_stock_item": 0,
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "description": "ERP",
   "item_code": "ERP",
   "item_name": "ERP",
@@ -81,15 +114,20 @@
  },
  {
   "is_stock_item": 0,
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+      "default_warehouse": "Stores",
+      "company": "Whitmore College"
+  }],
   "description": "Autocad",
   "item_code": "Autocad",
   "item_name": "Autocad",
   "item_group": "All Item Groups"
  },
  {
-  "default_warehouse": "Stores",
-  "default_warehouse": "Stores",
+  "item_defaults": [{
+        "default_warehouse": "Stores",
+        "company": "Whitmore College"
+  }],
   "item_code": "Service",
   "item_group": "Services",
   "item_name": "Service",
diff --git a/erpnext/demo/setup/education.py b/erpnext/demo/setup/education.py
index 2a894f7..0403c06 100644
--- a/erpnext/demo/setup/education.py
+++ b/erpnext/demo/setup/education.py
@@ -36,7 +36,8 @@
 		item = frappe.new_doc('Item')
 		item.update(i)
 		item.min_order_qty = random.randint(10, 30)
-		item.default_warehouse = frappe.get_all('Warehouse', filters={'warehouse_name': item.default_warehouse}, limit=1)[0].name
+		item.item_defaults[0].default_warehouse = frappe.get_all('Warehouse',
+			filters={'warehouse_name': item.item_defaults[0].default_warehouse}, limit=1)[0].name
 		item.insert()
 
 def make_student_applicants():
diff --git a/erpnext/demo/setup/manufacture.py b/erpnext/demo/setup/manufacture.py
index 4d8c450..4db510a 100644
--- a/erpnext/demo/setup/manufacture.py
+++ b/erpnext/demo/setup/manufacture.py
@@ -4,6 +4,7 @@
 import frappe
 from frappe.utils import nowdate, add_days
 from erpnext.demo.setup.setup_data import import_json
+from erpnext.demo.domains import data
 
 from six import iteritems
 
@@ -65,10 +66,11 @@
 	for i in items:
 		item = frappe.new_doc('Item')
 		item.update(i)
-		if item.default_warehouse:
-			warehouse = frappe.get_all('Warehouse', filters={'warehouse_name': item.default_warehouse}, limit=1)
+		if item.item_defaults[0].default_warehouse:
+			item.item_defaults[0].company = data.get("Manufacturing").get('company_name')
+			warehouse = frappe.get_all('Warehouse', filters={'warehouse_name': item.item_defaults[0].default_warehouse}, limit=1)
 			if warehouse:
-				item.default_warehouse = warehouse[0].name
+				item.item_defaults[0].default_warehouse = warehouse[0].name
 		item.insert()
 
 def setup_product_bundle():
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 559bbdf..c09ea11 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -544,14 +544,16 @@
 				item.image,
 				item.stock_uom,
 				item.allow_alternative_item,
-				item.default_warehouse,
-				item.expense_account as expense_account,
-				item.buying_cost_center as cost_center
+				item_default.default_warehouse,
+				item_default.expense_account as expense_account,
+				item_default.buying_cost_center as cost_center
 				{select_columns}
 			from
-				`tab{table}` bom_item, `tabBOM` bom, `tabItem` item
+				`tab{table}` bom_item, `tabBOM` bom, `tabItem` item, `tabItem Default` item_default
 			where
 				bom_item.docstatus < 2
+				and item_default.parent = item.name
+				and item_default.company = %(company)s
 				and bom.name = %(bom)s
 				and bom_item.parent = bom.name
 				and item.name = bom_item.item_code
@@ -564,14 +566,14 @@
 		query = query.format(table="BOM Explosion Item",
 			where_conditions="",
 			select_columns = ", bom_item.source_warehouse, (Select idx from `tabBOM Item` where item_code = bom_item.item_code and parent = %(parent)s ) as idx")
-		items = frappe.db.sql(query, { "parent": bom, "qty": qty,	"bom": bom }, as_dict=True)
+		items = frappe.db.sql(query, { "parent": bom, "qty": qty, "bom": bom, "company": company }, as_dict=True)
 	elif fetch_scrap_items:
 		query = query.format(table="BOM Scrap Item", where_conditions="", select_columns=", bom_item.idx")
-		items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
+		items = frappe.db.sql(query, { "qty": qty, "bom": bom, "company": company }, as_dict=True)
 	else:
 		query = query.format(table="BOM Item", where_conditions="",
 			select_columns = ", bom_item.source_warehouse, bom_item.idx")
-		items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
+		items = frappe.db.sql(query, { "qty": qty, "bom": bom, "company": company }, as_dict=True)
 
 	for item in items:
 		if item.item_code in item_dict:
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index ee64a16..006e542 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -293,14 +293,15 @@
 				for d in frappe.db.sql("""select bei.item_code, item.default_bom as bom,
 						ifnull(sum(bei.stock_qty/ifnull(bom.quantity, 1)), 0) as qty, item.item_name,
 						bei.description, bei.stock_uom, item.min_order_qty, bei.source_warehouse,
-						item.default_material_request_type, item.min_order_qty, item.default_warehouse
+						item.default_material_request_type, item.min_order_qty, item_default.default_warehouse
 					from
-						`tabBOM Explosion Item` bei, `tabBOM` bom, `tabItem` item
+						`tabBOM Explosion Item` bei, `tabBOM` bom, `tabItem` item, `tabItem Default` item_default
 					where
-						bom.name = bei.parent and item.name = bei.item_code 
-						and bei.docstatus < 2 and bom.name=%s and item.is_stock_item in (1, {0})
+						bom.name = bei.parent and item.name = bei.item_code and bei.docstatus < 2 
+						and item_default.parent = item.name and item_default.company=%s
+						and bom.name=%s and item.is_stock_item in (1, {0})
 					group by bei.item_code, bei.stock_uom""".format(self.include_non_stock_items),
-					data.bom_no, as_dict=1):
+					(self.company, data.bom_no), as_dict=1):
 						bom_wise_item_details.setdefault(d.item_code, d)
 			else:
 				bom_wise_item_details = self.get_subitems(data, bom_wise_item_details, data.bom_no, 1)
@@ -317,16 +318,18 @@
 				item.is_sub_contracted_item as is_sub_contracted, bom_item.source_warehouse,
 				item.default_bom as default_bom, bom_item.description as description,
 				bom_item.stock_uom as stock_uom, item.min_order_qty as min_order_qty,
-				item.default_warehouse
+				item_default.default_warehouse
 			FROM
-				`tabBOM Item` bom_item, `tabBOM` bom, tabItem item
+				`tabBOM Item` bom_item, `tabBOM` bom, tabItem item, `tabItem Default` item_default
 			where
 				bom.name = bom_item.parent and bom.name = %(bom)s
 				and bom_item.docstatus < 2 and bom_item.item_code = item.name
+				and item.name = item_default.parent and item_default.company = %(company)s
 				and item.is_stock_item in (1, {0})
 			group by bom_item.item_code""".format(self.include_non_stock_items),{
 				'bom': bom_no,
-				'parent_qty': parent_qty
+				'parent_qty': parent_qty,
+				'company': self.company
 			}, as_dict=1)
 
 		for d in items:
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index a2feddc..2f177ee 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -313,8 +313,8 @@
 		# clear default accounts, warehouses from item
 		if warehouses:
 			for f in ["default_warehouse", "website_warehouse"]:
-				frappe.db.sql("""update tabItem set %s=NULL where %s in (%s)"""
-					% (f, f, ', '.join(['%s']*len(warehouses))), tuple(warehouses))
+				frappe.db.sql("""update `tabItem Default` set %s=NULL where company=%s and %s in (%s)"""
+					% (f, self.name, f, ', '.join(['%s']*len(warehouses))), tuple(warehouses))
 
 			frappe.db.sql("""delete from `tabItem Reorder` where warehouse in (%s)"""
 				% ', '.join(['%s']*len(warehouses)), tuple(warehouses))
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 0289749..7dc9a89 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -882,3 +882,14 @@
 	if not matched:
 		frappe.throw(
 			_("Default Unit of Measure for Item {0} cannot be changed directly because you have already made some transaction(s) with another UOM. You will need to create a new Item to use a different Default UOM.").format(item))
+
+def get_item_details(item, company):
+	return frappe.db.sql('''
+		select
+			i.item_name, i.description, i.stock_uom, i.name, i.is_stock_item, i.item_code
+			id.expense_account, id.buying_cost_center, id.warehouse
+		from
+			`tabItem` i, `tabItem Default` id
+		where
+			i.name = id.parent and i.name = %s and id.company = %s
+	''', (item, company), as_dict=1)
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py
index 3f0d7fa..ee2ca98 100644
--- a/erpnext/stock/doctype/item/test_item.py
+++ b/erpnext/stock/doctype/item/test_item.py
@@ -35,8 +35,9 @@
 		item.update(properties)
 
 
-	if item.is_stock_item and not item.default_warehouse:
-		item.default_warehouse = "_Test Warehouse - _TC"
+	if item.is_stock_item:
+		for item_default in [doc for doc in item.item_defaults if not doc.default_warehouse]
+			item_default.default_warehouse = "_Test Warehouse - _TC"
 
 	item.insert()
 
@@ -199,7 +200,12 @@
 					"increment": 0.5
 				}
 			],
-			"default_warehouse": "_Test Warehouse - _TC",
+			"item_defaults": [
+				{
+					"default_warehouse": "_Test Warehouse - _TC",
+					"company": "_Test Company"
+				}
+			]
 			"has_variants": 1
 		})
 
@@ -305,5 +311,8 @@
 		item.item_group = "All Item Groups"
 		item.is_stock_item = is_stock_item or 1
 		item.valuation_rate = valuation_rate or 0.0
-		item.default_warehouse = warehouse or '_Test Warehouse - _TC'
+		item.append("item_defaults", {
+			"default_warehouse": warehouse or '_Test Warehouse - _TC',
+			"company": "_Test Company"
+		})
 		item.save()
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index 74dfa05..7ca5ead 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -18,9 +18,10 @@
 		from `tabProduct Bundle Item` t1, `tabProduct Bundle` t2
 		where t2.new_item_code=%s and t1.parent = t2.name order by t1.idx""", item_code, as_dict=1)
 
-def get_packing_item_details(item):
-	return frappe.db.sql("""select item_name, description, stock_uom, default_warehouse from `tabItem`
-		where name = %s""", item, as_dict = 1)[0]
+def get_packing_item_details(item, company):
+	return frappe.db.sql("""select i.item_name, i.description, i.stock_uom, id.default_warehouse
+		from `tabItem` i, `tabItem Default` id where id.parent=i.name and i.name = %s and id.company""",
+		(item, company), as_dict = 1)[0]
 
 def get_bin_qty(item, warehouse):
 	det = frappe.db.sql("""select actual_qty, projected_qty from `tabBin`
@@ -28,12 +29,13 @@
 	return det and det[0] or frappe._dict()
 
 def update_packing_list_item(doc, packing_item_code, qty, main_item_row, description):
-	item = get_packing_item_details(packing_item_code)
+	item = get_packing_item_details(packing_item_code, doc.company)
 
 	# check if exists
 	exists = 0
 	for d in doc.get("packed_items"):
-		if d.parent_item == main_item_row.item_code and d.item_code == packing_item_code and d.parent_detail_docname == main_item_row.name and d.description == description:
+		if d.parent_item == main_item_row.item_code and d.item_code == packing_item_code and\
+				d.parent_detail_docname == main_item_row.name and d.description == description:
 			pi, exists = d, 1
 			break
 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 233138f..49a278c 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -10,6 +10,7 @@
 from erpnext.stock.stock_ledger import get_previous_sle, NegativeStockError, get_valuation_rate
 from erpnext.stock.get_item_details import get_bin_details, get_default_cost_center, get_conversion_factor
 from erpnext.stock.doctype.batch.batch import get_batch_no, set_batch_nos, get_batch_qty
+from erpnext.stock.doctype.item.item import get_item_details
 from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
 from erpnext.stock.utils import get_bin
 import json
@@ -716,8 +717,7 @@
 			item_code = frappe.db.get_value("BOM", self.bom_no, "item")
 			to_warehouse = self.to_warehouse
 
-		item = frappe.db.get_value("Item", item_code, ["item_name",
-			"description", "stock_uom", "expense_account", "buying_cost_center", "name", "default_warehouse"], as_dict=1)
+		item = get_item_details(item_code, self.company)
 
 		if not self.work_order and not to_warehouse:
 			# in case of BOM
@@ -782,8 +782,8 @@
 
 		for item in wo_items:
 			qty = item.required_qty
-			item_account_details = frappe.db.get_value("Item", item.item_code, ["item_name",
-				"description", "stock_uom", "expense_account", "buying_cost_center", "name", "default_warehouse"], as_dict=1)
+
+			item_account_details = get_item_details(item.item_code, self.company)
 			# Take into account consumption if there are any.
 			if self.purpose == 'Manufacture':
 				req_qty_each = flt(item.required_qty / wo.qty)
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
index 3342768..ce32e01 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -49,7 +49,8 @@
 					args: {
 						warehouse: data.warehouse,
 						posting_date: frm.doc.posting_date,
-						posting_time: frm.doc.posting_time
+						posting_time: frm.doc.posting_time,
+						company:frm.doc.company
 					},
 					callback: function(r) {
 						var items = [];
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
index 938173d..e434233 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -268,12 +268,12 @@
 			self._cancel()
 
 @frappe.whitelist()
-def get_items(warehouse, posting_date, posting_time):
+def get_items(warehouse, posting_date, posting_time, company):
 	items = frappe.get_list("Bin", fields=["item_code"], filters={"warehouse": warehouse}, as_list=1)
 
-	items += frappe.get_list("Item", fields=["name"], filters= {"is_stock_item": 1, "has_serial_no": 0,
-		"has_batch_no": 0, "has_variants": 0, "disabled": 0, "default_warehouse": warehouse},
-			as_list=1)
+	items += frappe.db.sql_list('''select i.name from `tabItem` i, `tabItem Default` id where i.name = id.parent
+		and i.is_stock_item=1 and i.has_serial_no=0 and i.has_batch_no=0 and i.has_variants=0 and i.disabled=0
+		and id.default_warehouse=%s and id.company=%s''', (warehouse, company))
 
 	res = []
 	for item in set(items):
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index b336565..0351364 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -11,6 +11,8 @@
 from frappe.model.meta import get_field_precision
 from erpnext.stock.doctype.batch.batch import get_batch_no
 from erpnext import get_company_currency
+from erpnext.stock.doctype.item.item import get_item_details
+
 
 from six import string_types, iteritems
 
@@ -52,7 +54,7 @@
 
 		for bundle_item in bundled_items.items:
 			valuation_rate += \
-				flt(get_valuation_rate(bundle_item.item_code, out.get("warehouse")).get("valuation_rate") \
+				flt(get_valuation_rate(bundle_item.item_code, args.company, out.get("warehouse")).get("valuation_rate") \
 					* bundle_item.qty)
 
 		out.update({
@@ -60,7 +62,7 @@
 		})
 
 	else:
-		out.update(get_valuation_rate(args.item_code, out.get("warehouse")))
+		out.update(get_valuation_rate(args.item_code, args.company, out.get("warehouse")))
 
 	get_price_list_rate(args, item_doc, out)
 
@@ -203,8 +205,10 @@
 	user_default_warehouse_list = get_user_default_as_list('Warehouse')
 	user_default_warehouse = user_default_warehouse_list[0] \
 		if len(user_default_warehouse_list) == 1 else ""
-
-	warehouse = user_default_warehouse or item.default_warehouse or args.warehouse
+	
+	item_default_warehouse = [default.default_warehouse for default in item.item_defaults if default.company == args.company]
+	item_default_warehouse = item_default_warehouse[0] if item_default_warehouse else None
+	warehouse = user_default_warehouse or item_default_warehouse or args.warehouse
 
 	material_request_type = ''
 	if args.get('doctype') == "Material Request":
@@ -677,8 +681,9 @@
 		if bom:
 			return bom
 
-def get_valuation_rate(item_code, warehouse=None):
-	item = frappe.get_doc("Item", item_code)
+def get_valuation_rate(item_code, company, warehouse=None):
+	item = get_item_details(item_code, company)
+	# item = frappe.get_doc("Item", item_code)
 	if item.is_stock_item:
 		if not warehouse:
 			warehouse = item.default_warehouse
diff --git a/erpnext/utilities/user_progress_utils.py b/erpnext/utilities/user_progress_utils.py
index 20e533e..0377a0a 100644
--- a/erpnext/utilities/user_progress_utils.py
+++ b/erpnext/utilities/user_progress_utils.py
@@ -110,7 +110,10 @@
 					"is_stock_item": 1,
 					"item_group": _("Products"),
 					"stock_uom": _(args.get("item_uom_" + str(i))),
-					"default_warehouse": default_warehouse
+					"item_defaults": [{
+						"default_warehouse": default_warehouse,
+						"company": defaults.get("company_name")
+					}]
 				}).insert()
 
 			except frappe.NameError: