return defaults according to the company
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 2686493..daca56a 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -377,7 +377,7 @@
 
 		item = get_item_defaults(target.item_code, source_parent.company)
 		target.cost_center = frappe.db.get_value("Project", obj.project, "cost_center") \
-			or item.buying_cost_center \
+			or item.get("buying_cost_center") \
 			or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")
 
 	doc = get_mapped_doc("Purchase Order", source_name,	{
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 690ffa8..7fe61c9 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -499,7 +499,7 @@
 
 		if item:
 			target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") \
-				or item.selling_cost_center \
+				or item.get("selling_cost_center") \
 				or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")
 
 	target_doc = get_mapped_doc("Sales Order", source_name, {
@@ -559,8 +559,8 @@
 		if source_parent.project:
 			target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center")
 		if not target.cost_center and target.item_code:
-			item = get_item_defaults(target.item_code, source_parent.company)
-			target.cost_center = item.selling_cost_center \
+			item = get_item_defaults(target.item_code, target.company)
+			target.cost_center = item.get("selling_cost_center") \
 				or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")
 
 	doclist = get_mapped_doc("Sales Order", source_name, {
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index e32f76b..068b913 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -887,7 +887,7 @@
 			_("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_defaults(item, company):
-	return frappe.db.sql('''
+	item_defaults = frappe.db.sql('''
 		select
 			i.item_name, i.description, i.stock_uom, i.name, i.is_stock_item, i.item_code, i.item_group,
 			id.expense_account, id.buying_cost_center, id.default_warehouse, id.selling_cost_center
@@ -895,4 +895,9 @@
 			`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
+	''', (item, company), as_dict=1)
+	if item_defaults:
+		return item_defaults[0]
+	else:
+		return frappe.db.get_value("Item", item, ["name", "item_name", "description", "stock_uom",
+			"is_stock_item", "item_code", "item_group"], as_dict=1)
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 5a6384a..849a294 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -721,7 +721,7 @@
 
 		if not self.work_order and not to_warehouse:
 			# in case of BOM
-			to_warehouse = item.default_warehouse
+			to_warehouse = item.get("default_warehouse")
 
 		self.add_to_stock_entry_detail({
 			item.name: {
@@ -731,8 +731,8 @@
 				"item_name": item.item_name,
 				"description": item.description,
 				"stock_uom": item.stock_uom,
-				"expense_account": item.expense_account,
-				"cost_center": item.buying_cost_center,
+				"expense_account": item.get("expense_account"),
+				"cost_center": item.get("buying_cost_center"),
 			}
 		}, bom_no = self.bom_no)
 
@@ -807,8 +807,8 @@
 						"item_name": item.item_name,
 						"description": item.description,
 						"stock_uom": item_account_details.stock_uom,
-						"expense_account": item_account_details.expense_account,
-						"cost_center": item_account_details.buying_cost_center,
+						"expense_account": item_account_details.get("expense_account"),
+						"cost_center": item_account_details.get("buying_cost_center"),
 					}
 				})
 
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 52decce..562ac68 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -300,12 +300,12 @@
 
 
 def get_default_income_account(args, item):
-	return (item.income_account
+	return (item.get("income_account")
 		or args.income_account
 		or frappe.db.get_value("Item Group", item.item_group, "default_income_account"))
 
 def get_default_expense_account(args, item):
-	return (item.expense_account
+	return (item.get("expense_account")
 		or args.expense_account
 		or frappe.db.get_value("Item Group", item.item_group, "default_expense_account"))
 
@@ -319,7 +319,7 @@
 
 def get_default_cost_center(args, item):
 	return (frappe.db.get_value("Project", args.get("project"), "cost_center")
-		or (item.selling_cost_center if args.get("customer") else item.buying_cost_center)
+		or (item.get("selling_cost_center") if args.get("customer") else item.get("buying_cost_center"))
 		or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")
 		or args.get("cost_center"))