optimize(various)
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 47f5c73..a4be3b0 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -27,7 +27,7 @@
 	'''Returns the currency of the default company'''
 	company = get_default_company()
 	if company:
-		return frappe.db.get_value('Company', company, 'default_currency')
+		return frappe.get_cached_value('Company',  company,  'default_currency')
 
 def get_default_cost_center(company):
 	'''Returns the default cost center of the company'''
@@ -37,7 +37,7 @@
 	if not frappe.flags.company_cost_center:
 		frappe.flags.company_cost_center = {}
 	if not company in frappe.flags.company_cost_center:
-		frappe.flags.company_cost_center[company] = frappe.db.get_value('Company', company, 'cost_center')
+		frappe.flags.company_cost_center[company] = frappe.get_cached_value('Company',  company,  'cost_center')
 	return frappe.flags.company_cost_center[company]
 
 def get_company_currency(company):
@@ -45,7 +45,7 @@
 	if not frappe.flags.company_currency:
 		frappe.flags.company_currency = {}
 	if not company in frappe.flags.company_currency:
-		frappe.flags.company_currency[company] = frappe.db.get_value('Company', company, 'default_currency')
+		frappe.flags.company_currency[company] = frappe.get_cached_value('Company',  company,  'default_currency')
 	return frappe.flags.company_currency[company]
 
 def set_perpetual_inventory(enable=1, company=None):
@@ -58,7 +58,7 @@
 
 def encode_company_abbr(name, company):
 	'''Returns name encoded with company abbreviation'''
-	company_abbr = frappe.db.get_value("Company", company, "abbr")
+	company_abbr = frappe.get_cached_value('Company',  company,  "abbr")
 	parts = name.rsplit(" - ", 1)
 
 	if parts[-1].lower() != company_abbr.lower():
@@ -74,8 +74,8 @@
 		frappe.local.enable_perpetual_inventory = {}
 
 	if not company in frappe.local.enable_perpetual_inventory:
-		frappe.local.enable_perpetual_inventory[company] = frappe.db.get_value("Company",
-			company, "enable_perpetual_inventory") or 0
+		frappe.local.enable_perpetual_inventory[company] = frappe.get_cached_value('Company', 
+			company,  "enable_perpetual_inventory") or 0
 
 	return frappe.local.enable_perpetual_inventory[company]
 
@@ -87,8 +87,8 @@
 		frappe.local.default_finance_book = {}
 
 	if not company in frappe.local.default_finance_book:
-		frappe.local.default_finance_book[company] = frappe.db.get_value("Company",
-			company, "default_finance_book")
+		frappe.local.default_finance_book[company] = frappe.get_cached_value('Company', 
+			company,  "default_finance_book")
 
 	return frappe.local.default_finance_book[company]
 
@@ -108,8 +108,8 @@
 	You can also set global company flag in `frappe.flags.company`
 	'''
 	if company or frappe.flags.company:
-		return frappe.db.get_value('Company',
-			company or frappe.flags.company, 'country')
+		return frappe.get_cached_value('Company', 
+			company or frappe.flags.company,  'country')
 	elif frappe.flags.country:
 		return frappe.flags.country
 	else:
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index 5ea8358..7669ede 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -119,7 +119,7 @@
 
 	def validate_account_currency(self):
 		if not self.account_currency:
-			self.account_currency = frappe.db.get_value("Company", self.company, "default_currency")
+			self.account_currency = frappe.get_cached_value('Company',  self.company,  "default_currency")
 
 		elif self.account_currency != frappe.db.get_value("Account", self.name, "account_currency"):
 			if frappe.db.get_value("GL Entry", {"account": self.name}):
@@ -181,7 +181,7 @@
 	def generator():
 		account_currency, company = frappe.db.get_value("Account", account, ["account_currency", "company"])
 		if not account_currency:
-			account_currency = frappe.db.get_value("Company", company, "default_currency")
+			account_currency = frappe.get_cached_value('Company',  company,  "default_currency")
 
 		return account_currency
 
@@ -192,7 +192,7 @@
 
 def get_account_autoname(account_number, account_name, company):
 	# first validate if company exists
-	company = frappe.db.get_value("Company", company, ["abbr", "name"], as_dict=True)
+	company = frappe.get_cached_value('Company',  company,  ["abbr", "name"], as_dict=True)
 	if not company:
 		frappe.throw(_('Company {0} does not exist').format(company))
 
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
index 3f639cf..1bcc820 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
@@ -38,7 +38,7 @@
 						"report_type": report_type,
 						"account_number": account_number,
 						"account_type": child.get("account_type"),
-						"account_currency": frappe.db.get_value("Company", company, "default_currency"),
+						"account_currency": frappe.get_cached_value('Company',  company,  "default_currency"),
 						"tax_rate": child.get("tax_rate")
 					})
 
diff --git a/erpnext/accounts/doctype/accounting_period/accounting_period.py b/erpnext/accounts/doctype/accounting_period/accounting_period.py
index 32441db..f7190b7 100644
--- a/erpnext/accounts/doctype/accounting_period/accounting_period.py
+++ b/erpnext/accounts/doctype/accounting_period/accounting_period.py
@@ -14,7 +14,7 @@
 		self.bootstrap_doctypes_for_closing()
 
 	def autoname(self):
-		company_abbr = frappe.db.get_value("Company", self.company, "abbr")
+		company_abbr = frappe.get_cached_value('Company',  self.company,  "abbr")
 		self.name = " - ".join([self.period_name, company_abbr])
 	
 	def validate_overlap(self):
diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py
index 771ec8d..cce4d48 100644
--- a/erpnext/accounts/doctype/budget/budget.py
+++ b/erpnext/accounts/doctype/budget/budget.py
@@ -81,8 +81,8 @@
 
 	if args.get('company') and not args.fiscal_year:
 		args.fiscal_year = get_fiscal_year(args.get('posting_date'), company=args.get('company'))[0]
-		frappe.flags.exception_approver_role = frappe.db.get_value('Company',
-			args.get('company'), 'exception_budget_approver_role')
+		frappe.flags.exception_approver_role = frappe.get_cached_value('Company', 
+			args.get('company'),  'exception_budget_approver_role')
 
 	if not args.account:
 		args.account = args.get("expense_account")
@@ -155,7 +155,7 @@
 	actual_expense = amount or get_actual_expense(args)
 	if actual_expense > budget_amount:
 		diff = actual_expense - budget_amount
-		currency = frappe.db.get_value('Company', args.company, 'default_currency')
+		currency = frappe.get_cached_value('Company',  args.company,  'default_currency')
 
 		msg = _("{0} Budget for Account {1} against {2} {3} is {4}. It will exceed by {5}").format(
 				_(action_for), frappe.bold(args.account), args.budget_against_field, 
diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
index aa19a9e..ae77516 100644
--- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
+++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
@@ -85,7 +85,7 @@
 		if self.total_gain_loss == 0:
 			return
 
-		unrealized_exchange_gain_loss_account = frappe.db.get_value("Company", self.company,
+		unrealized_exchange_gain_loss_account = frappe.get_cached_value('Company',  self.company, 
 			"unrealized_exchange_gain_loss_account")
 		if not unrealized_exchange_gain_loss_account:
 			frappe.throw(_("Please set Unrealized Exchange Gain/Loss Account in Company {0}")
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index ba13ea4..f93c75a 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -69,8 +69,8 @@
 	def validate_inter_company_accounts(self):
 		if self.voucher_type == "Inter Company Journal Entry" and self.inter_company_journal_entry_reference:
 			doc = frappe.get_doc("Journal Entry", self.inter_company_journal_entry_reference)
-			account_currency = frappe.db.get_value("Company", self.company, "default_currency")
-			previous_account_currency = frappe.db.get_value("Company", doc.company, "default_currency")
+			account_currency = frappe.get_cached_value('Company',  self.company,  "default_currency")
+			previous_account_currency = frappe.get_cached_value('Company',  doc.company,  "default_currency")
 			if account_currency == previous_account_currency:
 				if self.total_credit != doc.total_debit or self.total_debit != doc.total_credit:
 					frappe.throw(_("Total Credit/ Debit Amount should be same as linked Journal Entry"))
@@ -611,7 +611,7 @@
 			account (of that type), otherwise return empty dict.
 		'''
 		if account_type=="Bank":
-			account = frappe.db.get_value("Company", company, "default_bank_account")
+			account = frappe.get_cached_value('Company',  company,  "default_bank_account")
 			if not account:
 				account_list = frappe.get_all("Account", filters = {"company": company,
 					"account_type": "Bank", "is_group": 0})
@@ -619,7 +619,7 @@
 					account = account_list[0].name
 
 		elif account_type=="Cash":
-			account = frappe.db.get_value("Company", company, "default_cash_account")
+			account = frappe.get_cached_value('Company',  company,  "default_cash_account")
 			if not account:
 				account_list = frappe.get_all("Account", filters = {"company": company,
 					"account_type": "Cash", "is_group": 0})
@@ -711,7 +711,7 @@
 
 
 def get_payment_entry(ref_doc, args):
-	cost_center = frappe.db.get_value("Company", ref_doc.company, "cost_center")
+	cost_center = frappe.get_cached_value('Company',  ref_doc.company,  "cost_center")
 	exchange_rate = 1
 	if args.get("party_account"):
 		# Modified to include the posting date for which the exchange rate is required.
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
index 679750d..cde8e8c 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
@@ -133,7 +133,7 @@
 	def get_invoice_dict(self, row=None):
 		def get_item_dict():
 			default_uom = frappe.db.get_single_value("Stock Settings", "stock_uom") or _("Nos")
-			cost_center = frappe.db.get_value("Company", self.company, "cost_center")
+			cost_center = frappe.get_cached_value('Company',  self.company,  "cost_center")
 			if not cost_center:
 				frappe.throw(
 					_("Please set the Default Cost Center in {0} company.").format(frappe.bold(self.company))
@@ -171,7 +171,7 @@
 			"posting_date": row.posting_date,
 			frappe.scrub(party_type): row.party,
 			"doctype": "Sales Invoice" if self.invoice_type == "Sales" else "Purchase Invoice",
-			"currency": frappe.db.get_value("Company", self.company, "default_currency")
+			"currency": frappe.get_cached_value('Company',  self.company,  "default_currency")
 		})
 
 		if self.invoice_type == "Sales":
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 456acba..9ce7ecb 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -515,7 +515,7 @@
 	def calculate_deductions(self, tax_details):
 		return {
 			"account": tax_details['tax']['account_head'],
-			"cost_center": frappe.db.get_value("Company", self.company, "cost_center"),
+			"cost_center": frappe.get_cached_value('Company',  self.company,  "cost_center"),
 			"amount": self.total_allocated_amount * (tax_details['tax']['rate'] / 100)
 		}
 
@@ -535,7 +535,7 @@
 					return []
 
 	party_account_currency = get_account_currency(args.get("party_account"))
-	company_currency = frappe.db.get_value("Company", args.get("company"), "default_currency")
+	company_currency = frappe.get_cached_value('Company',  args.get("company"),  "default_currency")
 
 	# Get negative outstanding sales /purchase invoices
 	negative_outstanding_invoices = []
@@ -686,7 +686,7 @@
 @frappe.whitelist()
 def get_company_defaults(company):
 	fields = ["write_off_account", "exchange_gain_loss_account", "cost_center"]
-	ret = frappe.db.get_value("Company", company, fields, as_dict=1)
+	ret = frappe.get_cached_value('Company',  company,  fields, as_dict=1)
 
 	for fieldname in fields:
 		if not ret[fieldname]:
diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
index 57516a1..2408235 100644
--- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
@@ -151,7 +151,7 @@
 
 	def test_payment_entry_against_ec(self):
 
-		payable = frappe.db.get_value('Company', "_Test Company", 'default_payable_account')
+		payable = frappe.get_cached_value('Company',  "_Test Company",  'default_payable_account')
 		ec = make_expense_claim(payable, 300, 300, "_Test Company", "Travel Expenses - _TC")
 		pe = get_payment_entry("Expense Claim", ec.name, bank_account="_Test Bank USD - _TC", bank_amount=300)
 		pe.reference_no = "1"
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
index 03d0918..86023aa 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -28,7 +28,7 @@
 				.format(self.closing_account_head))
 
 		account_currency = get_account_currency(self.closing_account_head)
-		company_currency = frappe.db.get_value("Company", self.company, "default_currency")
+		company_currency = frappe.get_cached_value('Company',  self.company,  "default_currency")
 		if account_currency != company_currency:
 			frappe.throw(_("Currency of the Closing Account must be {0}").format(company_currency))
 
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py
index fd41106..bf2e20c 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py
@@ -102,7 +102,7 @@
 
 def get_item_groups(pos_profile):
 	item_groups = []
-	pos_profile = frappe.get_doc('POS Profile', pos_profile)
+	pos_profile = frappe.get_cached_doc('POS Profile', pos_profile)
 
 	if pos_profile.get('item_groups'):
 		# Get items based on the item groups defined in the POS profile
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py
index bd66aa5..efcef46 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py
@@ -14,5 +14,5 @@
 
 	def autoname(self):
 		if self.company and self.title:
-			abbr = frappe.db.get_value('Company', self.company, 'abbr')
+			abbr = frappe.get_cached_value('Company',  self.company,  'abbr')
 			self.name = '{0} - {1}'.format(self.title, abbr)
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index b67b61c..a14c234 100755
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -495,7 +495,7 @@
 		address = frappe.get_doc('Address', name)
 	else:
 		address = frappe.new_doc('Address')
-		address.country = frappe.db.get_value('Company', args.get('company'), 'country')
+		address.country = frappe.get_cached_value('Company',  args.get('company'),  'country')
 		address.append('links', {
 			'link_doctype': 'Customer',
 			'link_name': customer
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index f559fc0..19c86d5 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -345,7 +345,7 @@
 			update_multi_mode_option(self, pos)
 
 		if not self.account_for_change_amount:
-			self.account_for_change_amount = frappe.db.get_value('Company', self.company, 'default_cash_account')
+			self.account_for_change_amount = frappe.get_cached_value('Company',  self.company,  'default_cash_account')
 
 		if pos:
 			self.allow_print_before_pay = pos.allow_print_before_pay
@@ -501,7 +501,7 @@
 
 	def validate_write_off_account(self):
 		if flt(self.write_off_amount) and not self.write_off_account:
-			self.write_off_account = frappe.db.get_value('Company', self.company, 'write_off_account')
+			self.write_off_account = frappe.get_cached_value('Company',  self.company,  'write_off_account')
 
 		if flt(self.write_off_amount) and not self.write_off_account:
 			msgprint(_("Please enter Write Off Account"), raise_exception=1)
@@ -830,7 +830,7 @@
 		# write off entries, applicable if only pos
 		if self.write_off_account and self.write_off_amount:
 			write_off_account_currency = get_account_currency(self.write_off_account)
-			default_cost_center = frappe.db.get_value('Company', self.company, 'cost_center')
+			default_cost_center = frappe.get_cached_value('Company',  self.company,  'cost_center')
 
 			gl_entries.append(
 				self.get_gl_dict({
@@ -1285,7 +1285,7 @@
 		frappe.throw(_("No {0} found for Inter Company Transactions.").format(partytype))
 
 	company = details.get("company")
-	default_currency = frappe.db.get_value("Company", company, "default_currency")
+	default_currency = frappe.get_cached_value('Company',  company,  "default_currency")
 	if default_currency != doc.currency:
 		frappe.throw(_("Company currencies of both the companies should match for Inter Company Transactions."))
 
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 3e8881c..468ed9f 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -1324,14 +1324,14 @@
 		return si
 
 	def test_company_monthly_sales(self):
-		existing_current_month_sales = frappe.db.get_value("Company", "_Test Company", "total_monthly_sales")
+		existing_current_month_sales = frappe.get_cached_value('Company',  "_Test Company",  "total_monthly_sales")
 
 		si = create_sales_invoice()
-		current_month_sales = frappe.db.get_value("Company", "_Test Company", "total_monthly_sales")
+		current_month_sales = frappe.get_cached_value('Company',  "_Test Company",  "total_monthly_sales")
 		self.assertEqual(current_month_sales, existing_current_month_sales + si.base_grand_total)
 
 		si.cancel()
-		current_month_sales = frappe.db.get_value("Company", "_Test Company", "total_monthly_sales")
+		current_month_sales = frappe.get_cached_value('Company',  "_Test Company",  "total_monthly_sales")
 		self.assertEqual(current_month_sales, existing_current_month_sales)
 
 	def test_rounding_adjustment(self):
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
index 9dee1f9..b46de6c 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
@@ -14,7 +14,7 @@
 
 	def autoname(self):
 		if self.company and self.title:
-			abbr = frappe.db.get_value('Company', self.company, 'abbr')
+			abbr = frappe.get_cached_value('Company',  self.company,  'abbr')
 			self.name = '{0} - {1}'.format(self.title, abbr)
 
 	def set_missing_values(self):
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index 0199e7d..1a8965e 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -66,7 +66,7 @@
 	# filter zero debit and credit entries
 	merged_gl_map = filter(lambda x: flt(x.debit, 9)!=0 or flt(x.credit, 9)!=0, merged_gl_map)
 	merged_gl_map = list(merged_gl_map)
-		
+
 	return merged_gl_map
 
 def check_if_in_list(gle, gl_map):
@@ -83,12 +83,12 @@
 def save_entries(gl_map, adv_adj, update_outstanding, from_repost=False):
 	if not from_repost:
 		validate_account_for_perpetual_inventory(gl_map)
-		
+
 	round_off_debit_credit(gl_map)
 
 	for entry in gl_map:
 		make_entry(entry, adv_adj, update_outstanding, from_repost)
-		
+
 		# check against budget
 		if not from_repost:
 			validate_expense_against_budget(entry)
@@ -115,7 +115,7 @@
 
 def round_off_debit_credit(gl_map):
 	precision = get_field_precision(frappe.get_meta("GL Entry").get_field("debit"),
-		currency=frappe.db.get_value("Company", gl_map[0].company, "default_currency", cache=True))
+		currency=frappe.get_cached_value('Company',  gl_map[0].company,  "default_currency"))
 
 	debit_credit_diff = 0.0
 	for entry in gl_map:
@@ -124,12 +124,12 @@
 		debit_credit_diff += entry.debit - entry.credit
 
 	debit_credit_diff = flt(debit_credit_diff, precision)
-	
+
 	if gl_map[0]["voucher_type"] in ("Journal Entry", "Payment Entry"):
 		allowance = 5.0 / (10**precision)
 	else:
 		allowance = .5
-	
+
 	if abs(debit_credit_diff) >= allowance:
 		frappe.throw(_("Debit and Credit not equal for {0} #{1}. Difference is {2}.")
 			.format(gl_map[0].voucher_type, gl_map[0].voucher_no, debit_credit_diff))
@@ -161,7 +161,7 @@
 	gl_map.append(round_off_gle)
 
 def get_round_off_account_and_cost_center(company):
-	round_off_account, round_off_cost_center = frappe.db.get_value("Company", company,
+	round_off_account, round_off_cost_center = frappe.get_cached_value('Company',  company,
 		["round_off_account", "round_off_cost_center"]) or [None, None]
 	if not round_off_account:
 		frappe.throw(_("Please mention Round Off Account in Company"))
@@ -195,7 +195,7 @@
 		validate_balance_type(entry["account"], adv_adj)
 		if not adv_adj:
 			validate_expense_against_budget(entry)
-		
+
 		if entry.get("against_voucher") and update_outstanding == 'Yes' and not adv_adj:
 			update_outstanding_amt(entry["account"], entry.get("party_type"), entry.get("party"), entry.get("against_voucher_type"),
 				entry.get("against_voucher"), on_cancel=True)
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index cc90c74..114ad86 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -210,7 +210,7 @@
 	if not account and party_type in ['Customer', 'Supplier']:
 		default_account_name = "default_receivable_account" \
 			if party_type=="Customer" else "default_payable_account"
-		account = frappe.db.get_value("Company", company, default_account_name)
+		account = frappe.get_cached_value('Company',  company,  default_account_name)
 
 	existing_gle_currency = get_party_gle_currency(party_type, party, company)
 	if existing_gle_currency:
@@ -273,8 +273,8 @@
 
 		party_account_currency = frappe.db.get_value("Account", account.account, "account_currency")
 		existing_gle_currency = get_party_gle_currency(doc.doctype, doc.name, account.company)
-		company_default_currency = frappe.db.get_value("Company",
-			frappe.db.get_default("Company"), "default_currency", cache=True)
+		company_default_currency = frappe.get_cached_value('Company',
+			frappe.db.get_default("Company"),  "default_currency")
 
 		if existing_gle_currency and party_account_currency != existing_gle_currency:
 			frappe.throw(_("Accounting entries have already been made in currency {0} for company {1}. Please select a receivable or payable account with currency {0}.").format(existing_gle_currency, account.company))
@@ -402,7 +402,7 @@
 			template = frappe.db.get_value("Supplier Group", supplier.supplier_group, fieldname='payment_terms')
 
 	if not template and company:
-		template = frappe.db.get_value("Company", company, fieldname='payment_terms')
+		template = frappe.get_cached_value('Company',  company,  fieldname='payment_terms')
 	return template
 
 def validate_party_frozen_disabled(party_type, party_name):
@@ -454,7 +454,7 @@
 	company = frappe.db.get_default("company") or frappe.get_all("Company")[0].name
 	party_account_currency = get_party_account_currency(party_type, party, company)
 	company_default_currency = get_default_currency() \
-		or frappe.db.get_value('Company', company, 'default_currency')
+		or frappe.get_cached_value('Company',  company,  'default_currency')
 
 	if party_account_currency==company_default_currency:
 		total_field = "base_grand_total"
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index 2b3e824..28543b5 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -132,7 +132,7 @@
 		if not self.filters.get("company"):
 			self.filters["company"] = frappe.db.get_single_value('Global Defaults', 'default_company')
 
-		company_currency = frappe.db.get_value("Company", self.filters.get("company"), "default_currency")
+		company_currency = frappe.get_cached_value('Company',  self.filters.get("company"),  "default_currency")
 
 		return_entries = self.get_return_entries(args.get("party_type"))
 
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 204eceb..7d9acf2 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -11,7 +11,7 @@
 	period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
 		filters.periodicity, company=filters.company)
 
-	currency = filters.presentation_currency or frappe.db.get_value("Company", filters.company, "default_currency")
+	currency = filters.presentation_currency or frappe.get_cached_value('Company',  filters.company,  "default_currency")
 
 	asset = get_data(filters.company, "Asset", "Debit", period_list,
 		only_current_fiscal_year=False, filters=filters,
@@ -65,7 +65,7 @@
 	total_row = {}
 	if asset and (liability or equity):
 		total = total_row_total=0
-		currency = currency or frappe.db.get_value("Company", company, "default_currency")
+		currency = currency or frappe.get_cached_value('Company',  company,  "default_currency")
 		total_row = {
 			"account_name": "'" + _("Total (Credit)") + "'",
 			"account": "'" + _("Total (Credit)") + "'",
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.py b/erpnext/accounts/report/cash_flow/cash_flow.py
index 56de941..9eda21e 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.py
+++ b/erpnext/accounts/report/cash_flow/cash_flow.py
@@ -29,7 +29,7 @@
 	net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
 
 	data = []
-	company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
+	company_currency = frappe.get_cached_value('Company',  filters.company,  "default_currency")
 	
 	for cash_flow_account in cash_flow_accounts:
 		section_data = []
diff --git a/erpnext/accounts/report/cash_flow/custom_cash_flow.py b/erpnext/accounts/report/cash_flow/custom_cash_flow.py
index ee0f38c..d0b283a 100644
--- a/erpnext/accounts/report/cash_flow/custom_cash_flow.py
+++ b/erpnext/accounts/report/cash_flow/custom_cash_flow.py
@@ -358,7 +358,7 @@
 
 	net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
 
-	company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
+	company_currency = frappe.get_cached_value('Company',  filters.company,  "default_currency")
 
 	data = compute_data(filters, company_currency, net_profit_loss, period_list, mappers, cash_flow_accounts)
 
diff --git a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
index b90a919..dd7de8d 100644
--- a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
+++ b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
@@ -58,7 +58,7 @@
 			"account_name": "'" + _("Unclosed Fiscal Years Profit / Loss (Credit)") + "'",
 			"account": "'" + _("Unclosed Fiscal Years Profit / Loss (Credit)") + "'",
 			"warn_if_negative": True,
-			"currency": frappe.db.get_value("Company", filters.company, "default_currency")
+			"currency": frappe.get_cached_value('Company',  filters.company,  "default_currency")
 		}
 		for company in companies:
 			unclosed[company] = opening_balance
@@ -91,7 +91,7 @@
 	return data, None, chart
 
 def get_income_expense_data(companies, fiscal_year, filters):
-	company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
+	company_currency = frappe.get_cached_value('Company',  filters.company,  "default_currency")
 	income = get_data(companies, "Income", "Credit", fiscal_year, filters, True)
 
 	expense = get_data(companies, "Expense", "Debit", fiscal_year, filters, True)
@@ -106,7 +106,7 @@
 	income, expense, net_profit_loss = get_income_expense_data(companies, fiscal_year, filters)
 
 	data = []
-	company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
+	company_currency = frappe.get_cached_value('Company',  filters.company,  "default_currency")
 
 	for cash_flow_account in cash_flow_accounts:
 		section_data = []
@@ -215,7 +215,7 @@
 	return out
 
 def get_company_currency(filters=None):
-	return frappe.db.get_value("Company", filters.get('company'), "default_currency")
+	return frappe.get_cached_value('Company',  filters.get('company'),  "default_currency")
 
 def calculate_values(accounts_by_name, gl_entries_by_account, companies, fiscal_year, filters):
 	for entries in gl_entries_by_account.values():
@@ -267,8 +267,8 @@
 	return all_companies, companies
 
 def get_subsidiary_companies(company):
-	lft, rgt = frappe.db.get_value('Company',
-		company, ["lft", "rgt"])
+	lft, rgt = frappe.get_cached_value('Company', 
+		company,  ["lft", "rgt"])
 
 	return frappe.db.sql_list("""select name from `tabCompany`
 		where lft >= {0} and rgt <= {1} order by lft, rgt""".format(lft, rgt))
@@ -321,8 +321,8 @@
 	accounts_by_name, ignore_closing_entries=False):
 	"""Returns a dict like { "account": [gl entries], ... }"""
 
-	company_lft, company_rgt = frappe.db.get_value('Company',
-		filters.get('company'), ["lft", "rgt"])
+	company_lft, company_rgt = frappe.get_cached_value('Company', 
+		filters.get('company'),  ["lft", "rgt"])
 
 	additional_conditions = get_additional_conditions(from_date, ignore_closing_entries, filters)
 
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 1ede508..3ac2eee 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -162,7 +162,7 @@
 	if filters and filters.get("presentation_currency"):
 		return filters["presentation_currency"]
 	else:
-		return frappe.db.get_value("Company", company, "default_currency")
+		return frappe.get_cached_value('Company',  company,  "default_currency")
 
 
 def calculate_values(
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index 804e3fe..f199797 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -72,7 +72,7 @@
 
 def set_account_currency(filters):
 	if filters.get("account") or (filters.get('party') and len(filters.party) == 1):
-		filters["company_currency"] = frappe.db.get_value("Company", filters.company, "default_currency")
+		filters["company_currency"] = frappe.get_cached_value('Company',  filters.company,  "default_currency")
 		account_currency = None
 
 		if filters.get("account"):
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index 2b0d5e7..19075d3 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -11,7 +11,7 @@
 
 def execute(filters=None):
 	if not filters: filters = frappe._dict()
-	filters.currency = frappe.db.get_value("Company", filters.company, "default_currency")
+	filters.currency = frappe.get_cached_value('Company',  filters.company,  "default_currency")
 
 	gross_profit_data = GrossProfitGenerator(filters)
 
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
index 8687dce..48d7361 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
@@ -39,7 +39,7 @@
 		"account_name": "'" + _("Profit for the year") + "'",
 		"account": "'" + _("Profit for the year") + "'",
 		"warn_if_negative": True,
-		"currency": currency or frappe.db.get_value("Company", company, "default_currency")
+		"currency": currency or frappe.get_cached_value('Company',  company,  "default_currency")
 	}
 
 	has_value = False
diff --git a/erpnext/accounts/report/profitability_analysis/profitability_analysis.py b/erpnext/accounts/report/profitability_analysis/profitability_analysis.py
index 8bc1954..39706ac 100644
--- a/erpnext/accounts/report/profitability_analysis/profitability_analysis.py
+++ b/erpnext/accounts/report/profitability_analysis/profitability_analysis.py
@@ -96,7 +96,7 @@
 
 def prepare_data(accounts, filters, total_row, parent_children_map, based_on):
 	data = []
-	company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency")
+	company_currency = frappe.get_cached_value('Company',  filters.get("company"),  "default_currency")
 
 	for d in accounts:
 		has_value = False
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py
index 7a298b3..5d24096 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -26,7 +26,7 @@
 	suppliers = list(set([d.supplier for d in invoice_list]))
 	supplier_details = get_supplier_details(suppliers)
 
-	company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
+	company_currency = frappe.get_cached_value('Company',  filters.company,  "default_currency")
 
 	data = []
 	for inv in invoice_list:
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index a318751..dd92c92 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -25,7 +25,7 @@
 	#Cost Center & Warehouse Map
 	invoice_cc_wh_map = get_invoice_cc_wh_map(invoice_list)
 	invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
-	company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency")
+	company_currency = frappe.get_cached_value('Company',  filters.get("company"),  "default_currency")
 	mode_of_payments = get_mode_of_payments([inv.name for inv in invoice_list])
 
 	data = []
diff --git a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
index 8be63a0..2508a1f 100644
--- a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
+++ b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
@@ -25,7 +25,7 @@
 	party_filters = {"name": filters.get("party")} if filters.get("party") else {}
 	parties = frappe.get_all(filters.get("party_type"), fields = ["name", party_name_field], 
 		filters = party_filters, order_by="name")
-	company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
+	company_currency = frappe.get_cached_value('Company',  filters.company,  "default_currency")
 	opening_balances = get_opening_balances(filters)
 	balances_within_period = get_balances_within_period(filters)
 
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 421a4fd..ae128a7 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -133,7 +133,7 @@
 
 			# If group and currency same as company,
 			# always return balance based on debit and credit in company currency
-			if acc.account_currency == frappe.db.get_value("Company", acc.company, "default_currency"):
+			if acc.account_currency == frappe.get_cached_value('Company',  acc.company,  "default_currency"):
 				in_account_currency = False
 		else:
 			cond.append("""gle.account = "%s" """ % (frappe.db.escape(account, percent=False), ))
@@ -275,7 +275,7 @@
 
 	if args.parent_cost_center == args.company:
 		args.parent_cost_center = "{0} - {1}".format(args.parent_cost_center,
-			frappe.db.get_value('Company', args.company, 'abbr'))
+			frappe.get_cached_value('Company',  args.company,  'abbr'))
 
 	cc = frappe.new_doc("Cost Center")
 	cc.update(args)
@@ -498,7 +498,7 @@
 
 @frappe.whitelist()
 def get_company_default(company, fieldname):
-	value = frappe.db.get_value("Company", company, fieldname)
+	value = frappe.get_cached_value('Company',  company,  fieldname)
 
 	if not value:
 		throw(_("Please set default {0} in Company {1}")
@@ -570,7 +570,7 @@
 	stock_rbnb = flt(pr_valuation_amount, 2) - flt(pi_valuation_amount, 2)
 
 	# Balance as per system
-	stock_rbnb_account = "Stock Received But Not Billed - " + frappe.db.get_value("Company", company, "abbr")
+	stock_rbnb_account = "Stock Received But Not Billed - " + frappe.get_cached_value('Company',  company,  "abbr")
 	sys_bal = get_balance_on(stock_rbnb_account, posting_date, in_account_currency=False)
 
 	# Amount should be credited
@@ -707,7 +707,7 @@
 
 	if doctype == 'Account':
 		sort_accounts(acc, is_root, key="value")
-		company_currency = frappe.db.get_value("Company", company, "default_currency")
+		company_currency = frappe.get_cached_value('Company',  company,  "default_currency")
 		for each in acc:
 			each["company_currency"] = company_currency
 			each["balance"] = flt(get_balance_on(each.get("value"), in_account_currency=False))
@@ -809,7 +809,7 @@
 		name_split=name.split("-")
 		parts = [doc_title.strip(), name_split[len(name_split)-1].strip()]
 	else:
-		abbr = frappe.db.get_value("Company", company, ["abbr"], as_dict=True)
+		abbr = frappe.get_cached_value('Company',  company,  ["abbr"], as_dict=True)
 		parts = [doc_title.strip(), abbr.abbr]
 	if cstr(number_value).strip():
 		parts.insert(0, cstr(number_value).strip())
diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py
index e475a5e..024dd62 100644
--- a/erpnext/assets/doctype/asset/asset.py
+++ b/erpnext/assets/doctype/asset/asset.py
@@ -410,7 +410,7 @@
 def make_purchase_invoice(asset, item_code, gross_purchase_amount, company, posting_date):
 	pi = frappe.new_doc("Purchase Invoice")
 	pi.company = company
-	pi.currency = frappe.db.get_value("Company", company, "default_currency")
+	pi.currency = frappe.get_cached_value('Company',  company,  "default_currency")
 	pi.set_posting_time = 1
 	pi.posting_date = posting_date
 	pi.append("items", {
@@ -429,7 +429,7 @@
 def make_sales_invoice(asset, item_code, company, serial_no=None):
 	si = frappe.new_doc("Sales Invoice")
 	si.company = company
-	si.currency = frappe.db.get_value("Company", company, "default_currency")
+	si.currency = frappe.get_cached_value('Company',  company,  "default_currency")
 	disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(company)
 	si.append("items", {
 		"item_code": item_code,
@@ -504,7 +504,7 @@
 				asset_category = asset_category, company = company)
 
 	if not account:
-		account = frappe.db.get_value('Company', company, account_name)
+		account = frappe.get_cached_value('Company',  company,  account_name)
 
 	if not account:
 		frappe.throw(_("Set {0} in asset category {1} or company {2}")
diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py
index 446066c..1a96579 100644
--- a/erpnext/assets/doctype/asset/depreciation.py
+++ b/erpnext/assets/doctype/asset/depreciation.py
@@ -35,7 +35,7 @@
 	fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account = \
 		get_depreciation_accounts(asset)
 
-	depreciation_cost_center, depreciation_series = frappe.db.get_value("Company", asset.company,
+	depreciation_cost_center, depreciation_series = frappe.get_cached_value('Company',  asset.company, 
 		["depreciation_cost_center", "series_for_depreciation_entry"])
 
 	depreciation_cost_center = asset.cost_center or depreciation_cost_center
@@ -93,7 +93,7 @@
 		depreciation_expense_account = accounts.depreciation_expense_account
 		
 	if not accumulated_depreciation_account or not depreciation_expense_account:
-		accounts = frappe.db.get_value("Company", asset.company,
+		accounts = frappe.get_cached_value('Company',  asset.company, 
 			["accumulated_depreciation_account", "depreciation_expense_account"])
 		
 		if not accumulated_depreciation_account:
@@ -116,7 +116,7 @@
 	elif asset.status in ("Cancelled", "Sold", "Scrapped"):
 		frappe.throw(_("Asset {0} cannot be scrapped, as it is already {1}").format(asset.name, asset.status))
 
-	depreciation_series = frappe.db.get_value("Company", asset.company, "series_for_depreciation_entry")
+	depreciation_series = frappe.get_cached_value('Company',  asset.company,  "series_for_depreciation_entry")
 
 	je = frappe.new_doc("Journal Entry")
 	je.voucher_type = "Journal Entry"
@@ -189,7 +189,7 @@
 
 @frappe.whitelist()
 def get_disposal_account_and_cost_center(company):
-	disposal_account, depreciation_cost_center = frappe.db.get_value("Company", company,
+	disposal_account, depreciation_cost_center = frappe.get_cached_value('Company',  company, 
 		["disposal_account", "depreciation_cost_center"])
 
 	if not disposal_account:
diff --git a/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py b/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py
index d248803..ac3c350 100644
--- a/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py
+++ b/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py
@@ -36,7 +36,7 @@
 		fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account = \
 			get_depreciation_accounts(asset)
 
-		depreciation_cost_center, depreciation_series = frappe.db.get_value("Company", asset.company,
+		depreciation_cost_center, depreciation_series = frappe.get_cached_value('Company',  asset.company, 
 			["depreciation_cost_center", "series_for_depreciation_entry"])
 
 		je = frappe.new_doc("Journal Entry")
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index c67d4e5..f150736 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -183,7 +183,7 @@
 			"supplier" : "_Test Supplier",
 			"is_subcontracted" : "No",
 			"schedule_date": add_days(nowdate(), 1),
-			"currency" : frappe.db.get_value("Company", "_Test Company", "default_currency"),
+			"currency" : frappe.get_cached_value('Company',  "_Test Company",  "default_currency"),
 			"conversion_factor" : 1,
 			"items" : get_same_items(),
 			"group_same_items": 1
@@ -520,7 +520,7 @@
 	po.company = args.company or "_Test Company"
 	po.supplier = args.customer or "_Test Supplier"
 	po.is_subcontracted = args.is_subcontracted or "No"
-	po.currency = args.currency or frappe.db.get_value("Company", po.company, "default_currency")
+	po.currency = args.currency or frappe.get_cached_value('Company',  po.company,  "default_currency")
 	po.conversion_factor = args.conversion_factor or 1
 	po.supplier_warehouse = args.supplier_warehouse or None
 
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 5175395..449ea36 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -400,7 +400,7 @@
 			else:
 				allocated_amount = min(self.grand_total - advance_allocated, d.amount)
 			advance_allocated += flt(allocated_amount)
-			
+
 			self.append("advances", {
 				"doctype": self.doctype + " Advance",
 				"reference_type": d.reference_type,
@@ -606,7 +606,7 @@
 	@property
 	def company_abbr(self):
 		if not hasattr(self, "_abbr"):
-			self._abbr = frappe.db.get_value("Company", self.company, "abbr")
+			self._abbr = frappe.get_cached_value('Company',  self.company,  "abbr")
 
 		return self._abbr
 
@@ -841,7 +841,7 @@
 def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, company):
 	"""common validation for currency and price list currency"""
 
-	company_currency = frappe.db.get_value("Company", company, "default_currency", cache=True)
+	company_currency = frappe.get_cached_value('Company',  company,  "default_currency")
 
 	if not conversion_rate:
 		throw(_("{0} is mandatory. Maybe Currency Exchange record is not created for {1} to {2}.").format(
diff --git a/erpnext/controllers/print_settings.py b/erpnext/controllers/print_settings.py
index cb73159..c41db25 100644
--- a/erpnext/controllers/print_settings.py
+++ b/erpnext/controllers/print_settings.py
@@ -12,7 +12,7 @@
 	}
 	doc.hide_in_print_layout = ["uom", "stock_uom"]
 
-	doc.flags.compact_item_print = cint(frappe.db.get_value("Print Settings", None, "compact_item_print"))
+	doc.flags.compact_item_print = cint(frappe.db.get_single_value("Print Settings", "compact_item_print"))
 
 	if doc.flags.compact_item_print:
 		doc.print_templates["description"] = "templates/print_formats/includes/item_table_description.html"
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 748fe59..052ea03 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -8,6 +8,7 @@
 from erpnext.stock.get_item_details import get_bin_details
 from erpnext.stock.utils import get_incoming_rate
 from erpnext.stock.get_item_details import get_conversion_factor
+from erpnext.stock.doctype.item.item import get_item_defaults, set_item_default
 
 from erpnext.controllers.stock_controller import StockController
 
@@ -40,7 +41,7 @@
 		self.validate_selling_price()
 		self.set_qty_as_per_stock_uom()
 		self.set_po_nos()
-		check_active_sales_items(self)
+		set_default_income_account_for_item(self)
 
 	def set_missing_values(self, for_validate=False):
 		super(SellingController, self).set_missing_values(for_validate)
@@ -349,24 +350,8 @@
 		from erpnext.controllers.buying_controller import validate_item_type
 		validate_item_type(self, "is_sales_item", "sales")
 
-def check_active_sales_items(obj):
+def set_default_income_account_for_item(obj):
 	for d in obj.get("items"):
 		if d.item_code:
-			item = frappe.db.sql("""select i.docstatus, id.income_account
-				from `tabItem` i, `tabItem Default` id
-				where i.name=%s and id.parent=i.name and id.company=%s""",
-				(d.item_code, obj.company), as_dict=True)
-
 			if getattr(d, "income_account", None):
-				doc = frappe.get_doc("Item", d.item_code)
-				if item and not item[0].income_account:
-					for default in doc.item_defaults:
-						if default.company == obj.company:
-							default.income_account = d.income_account
-							break
-				elif not item:
-					doc.append("item_defaults", {
-						"company": obj.company,
-						"income_account": d.income_account
-					})
-				doc.save(ignore_permissions=True)
+				set_item_default(d.item_code, obj.company, 'income_account', d.income_account)
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index 5c203d9..e8da4e6 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -217,7 +217,7 @@
 		from erpnext.controllers.accounts_controller import get_default_taxes_and_charges
 		quotation = frappe.get_doc(target)
 
-		company_currency = frappe.db.get_value("Company", quotation.company, "default_currency")
+		company_currency = frappe.get_cached_value('Company',  quotation.company,  "default_currency")
 		party_account_currency = get_party_account_currency("Customer", quotation.customer,
 			quotation.company) if quotation.customer else company_currency
 
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index 41f24e1..dbb6594 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -293,7 +293,7 @@
 	}).insert()
 
 def setup_mode_of_payment():
-	company_abbr = frappe.db.get_value("Company", erpnext.get_default_company(), "abbr")
+	company_abbr = frappe.get_cached_value('Company',  erpnext.get_default_company(),  "abbr")
 	account_dict = {'Cash': 'Cash - '+ company_abbr , 'Bank': 'National Bank - '+ company_abbr}
 	for payment_mode in frappe.get_all('Mode of Payment', fields = ["name", "type"]):
 		if payment_mode.type:
@@ -317,7 +317,7 @@
 	frappe.flags.in_import = False
 
 def setup_account_to_expense_type():
-	company_abbr = frappe.db.get_value("Company", erpnext.get_default_company(), "abbr")
+	company_abbr = frappe.get_cached_value('Company',  erpnext.get_default_company(),  "abbr")
 	expense_types = [{'name': _('Calls'), "account": "Sales Expenses - "+ company_abbr},
 		{'name': _('Food'), "account": "Entertainment Expenses - "+ company_abbr},
 		{'name': _('Medical'), "account": "Utility Expenses - "+ company_abbr},
@@ -354,7 +354,7 @@
 		budget.submit()
 
 def setup_pos_profile():
-	company_abbr = frappe.db.get_value("Company", erpnext.get_default_company(), "abbr")
+	company_abbr = frappe.get_cached_value('Company',  erpnext.get_default_company(),  "abbr")
 	pos = frappe.new_doc('POS Profile')
 	pos.user = frappe.db.get_global('demo_accounts_user')
 	pos.pos_profile_name = "Demo POS Profile"
diff --git a/erpnext/demo/user/accounts.py b/erpnext/demo/user/accounts.py
index 1a41482..a12933b 100644
--- a/erpnext/demo/user/accounts.py
+++ b/erpnext/demo/user/accounts.py
@@ -28,7 +28,7 @@
 				si.posting_date = frappe.flags.current_date
 				for d in si.get("items"):
 					if not d.income_account:
-						d.income_account = "Sales - {}".format(frappe.db.get_value('Company', si.company, 'abbr'))
+						d.income_account = "Sales - {}".format(frappe.get_cached_value('Company',  si.company,  'abbr'))
 				si.insert()
 				si.submit()
 				frappe.db.commit()
@@ -106,7 +106,7 @@
 		si.posting_date = frappe.flags.current_date
 		for d in si.get("items"):
 			if not d.income_account:
-				d.income_account = "Sales - {}".format(frappe.db.get_value('Company', si.company, 'abbr'))
+				d.income_account = "Sales - {}".format(frappe.get_cached_value('Company',  si.company,  'abbr'))
 		si.set_missing_values()
 		make_payment_entries_for_pos_invoice(si)
 		si.insert()
diff --git a/erpnext/demo/user/manufacturing.py b/erpnext/demo/user/manufacturing.py
index a3f631c..0231eda9 100644
--- a/erpnext/demo/user/manufacturing.py
+++ b/erpnext/demo/user/manufacturing.py
@@ -78,7 +78,7 @@
 		st.posting_date = frappe.flags.current_date
 		st.fiscal_year = str(frappe.flags.current_date.year)
 		for d in st.get("items"):
-			d.cost_center = "Main - " + frappe.db.get_value('Company', st.company, 'abbr')
+			d.cost_center = "Main - " + frappe.get_cached_value('Company',  st.company,  'abbr')
 		st.insert()
 		frappe.db.commit()
 		st.submit()
diff --git a/erpnext/demo/user/purchase.py b/erpnext/demo/user/purchase.py
index 327f617..ad99de9 100644
--- a/erpnext/demo/user/purchase.py
+++ b/erpnext/demo/user/purchase.py
@@ -51,7 +51,7 @@
 	# get supplier details
 	supplier = get_random("Supplier")
 
-	company_currency = frappe.db.get_value("Company", "Wind Power LLC", "default_currency")
+	company_currency = frappe.get_cached_value('Company',  "Wind Power LLC",  "default_currency")
 	party_account_currency = get_party_account_currency("Supplier", supplier, "Wind Power LLC")
 	if company_currency == party_account_currency:
 		exchange_rate = 1
diff --git a/erpnext/demo/user/sales.py b/erpnext/demo/user/sales.py
index 02e1d42..65d7f55 100644
--- a/erpnext/demo/user/sales.py
+++ b/erpnext/demo/user/sales.py
@@ -84,7 +84,7 @@
 		# get customer, currency and exchange_rate
 		customer = get_random("Customer")
 
-		company_currency = frappe.db.get_value("Company", "Wind Power LLC", "default_currency")
+		company_currency = frappe.get_cached_value('Company',  "Wind Power LLC",  "default_currency")
 		party_account_currency = get_party_account_currency("Customer", customer, "Wind Power LLC")
 		if company_currency == party_account_currency:
 			exchange_rate = 1
diff --git a/erpnext/demo/user/stock.py b/erpnext/demo/user/stock.py
index f5ec4f9..a6b0e00 100644
--- a/erpnext/demo/user/stock.py
+++ b/erpnext/demo/user/stock.py
@@ -55,7 +55,7 @@
 			for d in dn.get("items"):
 				if not d.expense_account:
 					d.expense_account = ("Cost of Goods Sold - {0}".format(
-						frappe.db.get_value('Company', dn.company, 'abbr')))
+						frappe.get_cached_value('Company',  dn.company,  'abbr')))
 			dn.insert()
 			try:
 				dn.submit()
diff --git a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
index 6346f1f..97d8a02 100644
--- a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
+++ b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
@@ -86,7 +86,7 @@
 				# in stock uom
 				se_child.transfer_qty = flt(item.transfer_qty)
 				se_child.conversion_factor = flt(item.conversion_factor)
-				cost_center = frappe.db.get_value('Company', self.company, 'cost_center')
+				cost_center = frappe.get_cached_value('Company',  self.company,  'cost_center')
 				se_child.cost_center = cost_center
 				se_child.expense_account = expense_account
 		return stock_entry.as_dict()
@@ -146,7 +146,7 @@
 	expense_account = get_account(None, "expense_account", "Healthcare Settings", doc.company)
 
 	for item_line in stock_entry.items:
-		cost_center = frappe.db.get_value('Company', doc.company, 'cost_center')
+		cost_center = frappe.get_cached_value('Company',  doc.company,  'cost_center')
 		#item_line.s_warehouse = warehouse #deaful source warehouse set, stock entry to copy to lines
 		item_line.cost_center = cost_center
 		#if not expense_account:
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
index 3a142f5..8c3cdfe 100644
--- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
@@ -48,7 +48,7 @@
     receivable_account = get_account(None, "receivable_account", "Healthcare Settings", company)
     if receivable_account:
         return receivable_account
-    return frappe.db.get_value("Company", company, "default_receivable_account")
+    return frappe.get_cached_value('Company',  company,  "default_receivable_account")
 
 def get_income_account(practitioner, company):
     if(practitioner):
@@ -58,7 +58,7 @@
     income_account = get_account(None, "income_account", "Healthcare Settings", company)
     if income_account:
         return income_account
-    return frappe.db.get_value("Company", company, "default_income_account")
+    return frappe.get_cached_value('Company',  company,  "default_income_account")
 
 def get_account(parent_type, parent_field, parent, company):
     if(parent_type):
diff --git a/erpnext/hr/doctype/department/department.py b/erpnext/hr/doctype/department/department.py
index 8c6a764..9b2b581 100644
--- a/erpnext/hr/doctype/department/department.py
+++ b/erpnext/hr/doctype/department/department.py
@@ -25,7 +25,7 @@
 
 	def before_rename(self, old, new, merge=False):
 		# renaming consistency with abbreviation
-		if not frappe.db.get_value('Company', self.company, 'abbr') in new:
+		if not frappe.get_cached_value('Company',  self.company,  'abbr') in new:
 			new = get_abbreviated_name(new, self.company)
 
 		return new
@@ -41,7 +41,7 @@
 	frappe.db.add_index("Department", ["lft", "rgt"])
 
 def get_abbreviated_name(name, company):
-	abbr = frappe.db.get_value('Company', company, 'abbr')
+	abbr = frappe.get_cached_value('Company',  company,  'abbr')
 	new_name = '{0} - {1}'.format(name, abbr)
 	return new_name
 
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index a2de336..7285e04 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -253,7 +253,7 @@
 		company=frappe.db.get_value("Global Defaults", None, "default_company")
 
 	if not holiday_list:
-		holiday_list = frappe.db.get_value("Company", company, "default_holiday_list")
+		holiday_list = frappe.get_cached_value('Company',  company,  "default_holiday_list")
 
 	if not holiday_list and raise_exception:
 		frappe.throw(_('Please set a default Holiday List for Employee {0} or Company {1}').format(employee, company))
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py
index e5dfe6f..fff18cd 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.py
@@ -53,11 +53,11 @@
 
 	def set_payable_account(self):
 		if not self.payable_account and not self.is_paid:
-			self.payable_account = frappe.db.get_value("Company", self.company, "default_payable_account")
+			self.payable_account = frappe.get_cached_value('Company',  self.company,  "default_payable_account")
 
 	def set_cost_center(self):
 		if not self.cost_center:
-			self.cost_center = frappe.db.get_value('Company', self.company, 'cost_center')
+			self.cost_center = frappe.get_cached_value('Company',  self.company,  'cost_center')
 
 	def on_submit(self):
 		if self.approval_status=="Draft":
@@ -311,8 +311,8 @@
 @frappe.whitelist()
 def get_expense_claim(
 	employee_name, company, employee_advance_name, posting_date, paid_amount, claimed_amount):
-	default_payable_account = frappe.db.get_value("Company", company, "default_payable_account")
-	default_cost_center = frappe.db.get_value('Company', company, 'cost_center')
+	default_payable_account = frappe.get_cached_value('Company',  company,  "default_payable_account")
+	default_cost_center = frappe.get_cached_value('Company',  company,  'cost_center')
 
 	expense_claim = frappe.new_doc('Expense Claim')
 	expense_claim.company = company
diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.py b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
index 3e031c9..075bc63 100644
--- a/erpnext/hr/doctype/expense_claim/test_expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
@@ -100,7 +100,7 @@
 		self.assertEquals(len(gl_entry), 0)
 
 def get_payable_account(company):
-	return frappe.db.get_value('Company', company, 'default_payable_account')
+	return frappe.get_cached_value('Company',  company,  'default_payable_account')
 
 def make_expense_claim(payable_account,claim_amount, sanctioned_amount, company, account, project=None, task_name=None):
 	expense_claim = frappe.get_doc({
diff --git a/erpnext/hr/doctype/job_opening/job_opening.py b/erpnext/hr/doctype/job_opening/job_opening.py
index 226080f..4fc2ac1 100644
--- a/erpnext/hr/doctype/job_opening/job_opening.py
+++ b/erpnext/hr/doctype/job_opening/job_opening.py
@@ -37,7 +37,7 @@
 
 		if self.staffing_plan and self.planned_vacancies:
 			staffing_plan_company = frappe.db.get_value("Staffing Plan", self.staffing_plan, "company")
-			lft, rgt = frappe.db.get_value("Company", staffing_plan_company, ["lft", "rgt"])
+			lft, rgt = frappe.get_cached_value('Company',  staffing_plan_company,  ["lft", "rgt"])
 
 			designation_counts = get_designation_counts(self.designation, self.company)
 			current_count = designation_counts['employee_count'] + designation_counts['job_openings']
diff --git a/erpnext/hr/doctype/payroll_entry/payroll_entry.py b/erpnext/hr/doctype/payroll_entry/payroll_entry.py
index 8f54697..e097cc2 100644
--- a/erpnext/hr/doctype/payroll_entry/payroll_entry.py
+++ b/erpnext/hr/doctype/payroll_entry/payroll_entry.py
@@ -196,8 +196,8 @@
 		return account_dict
 
 	def get_default_payroll_payable_account(self):
-		payroll_payable_account = frappe.db.get_value("Company",
-			{"company_name": self.company}, "default_payroll_payable_account")
+		payroll_payable_account = frappe.get_cached_value('Company', 
+			{"company_name": self.company},  "default_payroll_payable_account")
 
 		if not payroll_payable_account:
 			frappe.throw(_("Please set Default Payroll Payable Account in Company {0}")
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index 0b23238..144022b 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -330,12 +330,12 @@
 	sal_comp.save()
 
 def create_account(company):
-	salary_account = frappe.db.get_value("Account", "Salary - " + frappe.db.get_value('Company', company, 'abbr'))
+	salary_account = frappe.db.get_value("Account", "Salary - " + frappe.get_cached_value('Company',  company,  'abbr'))
 	if not salary_account:
 		frappe.get_doc({
 		"doctype": "Account",
 		"account_name": "Salary",
-		"parent_account": "Indirect Expenses - " + frappe.db.get_value('Company', company, 'abbr'),
+		"parent_account": "Indirect Expenses - " + frappe.get_cached_value('Company',  company,  'abbr'),
 		"company": company
 		}).insert()
 	return salary_account
diff --git a/erpnext/hr/doctype/staffing_plan/staffing_plan.py b/erpnext/hr/doctype/staffing_plan/staffing_plan.py
index ac3f25f..70e185c 100644
--- a/erpnext/hr/doctype/staffing_plan/staffing_plan.py
+++ b/erpnext/hr/doctype/staffing_plan/staffing_plan.py
@@ -52,7 +52,7 @@
 				.format(overlap[0][0], staffing_plan_detail.designation)))
 
 	def validate_with_parent_plan(self, staffing_plan_detail):
-		if not frappe.db.get_value("Company", self.company, "parent_company"):
+		if not frappe.get_cached_value('Company',  self.company,  "parent_company"):
 			return # No parent, nothing to validate
 
 		# Get staffing plan applicable for the company (Parent Company)
@@ -74,7 +74,7 @@
 					parent_company)), ParentCompanyError)
 
 		#Get vacanices already planned for all companies down the hierarchy of Parent Company
-		lft, rgt = frappe.db.get_value("Company", parent_company, ["lft", "rgt"])
+		lft, rgt = frappe.get_cached_value('Company',  parent_company,  ["lft", "rgt"])
 		all_sibling_details = frappe.db.sql("""select sum(spd.vacancies) as vacancies,
 			sum(spd.total_estimated_cost) as total_estimated_cost
 			from `tabStaffing Plan Detail` spd join `tabStaffing Plan` sp on spd.parent=sp.name
@@ -123,7 +123,7 @@
 		return False
 
 	employee_counts_dict = {}
-	lft, rgt = frappe.db.get_value("Company", company, ["lft", "rgt"])
+	lft, rgt = frappe.get_cached_value('Company',  company,  ["lft", "rgt"])
 	employee_counts_dict["employee_count"] = frappe.db.sql("""select count(*) from `tabEmployee`
 		where designation = %s and status='Active'
 			and company in (select name from tabCompany where lft>=%s and rgt<=%s)
@@ -148,7 +148,7 @@
 		and to_date >= %s and from_date <= %s """, (company, designation, from_date, to_date), as_dict = 1)
 
 	if not staffing_plan:
-		parent_company = frappe.db.get_value("Company", company, "parent_company")
+		parent_company = frappe.get_cached_value('Company',  company,  "parent_company")
 		if parent_company:
 			staffing_plan = get_active_staffing_plan_details(parent_company,
 				designation, from_date, to_date)
diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
index 0c338e0..e9c7029 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
@@ -16,7 +16,7 @@
 	emp_map = get_employee_details()
 
 	holiday_list = [emp_map[d]["holiday_list"] for d in emp_map if emp_map[d]["holiday_list"]]
-	default_holiday_list = frappe.db.get_value("Company", filters.get("company"), "default_holiday_list")
+	default_holiday_list = frappe.get_cached_value('Company',  filters.get("company"),  "default_holiday_list")
 	holiday_list.append(default_holiday_list)
 	holiday_list = list(set(holiday_list))
 	holiday_map = get_holiday(holiday_list, filters["month"])
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
index 6015bd6..3a64e1a 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
@@ -105,7 +105,7 @@
 		if employee:
 			holiday_list = get_holiday_list_for_employee(employee)
 		else:
-			holiday_list = frappe.db.get_value("Company", self.company, "default_holiday_list")
+			holiday_list = frappe.get_cached_value('Company',  self.company,  "default_holiday_list")
 
 		holidays = frappe.db.sql_list('''select holiday_date from `tabHoliday` where parent=%s''', holiday_list)
 
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 84252a0..e5a62f2 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -592,7 +592,7 @@
 			["Cost Center", "cost_center", "cost_center"], ["Warehouse", "default_warehouse", ""]]:
 				company_in_record = frappe.db.get_value(d[0], item_details.get(d[1]), "company")
 				if not item_details.get(d[1]) or (company_in_record and company != company_in_record):
-					item_dict[item][d[1]] = frappe.db.get_value("Company", company, d[2]) if d[2] else None
+					item_dict[item][d[1]] = frappe.get_cached_value('Company',  company,  d[2]) if d[2] else None
 
 	return item_dict
 
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.py b/erpnext/manufacturing/doctype/workstation/workstation.py
index dd1c9f2..f6ab72a 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.py
+++ b/erpnext/manufacturing/doctype/workstation/workstation.py
@@ -45,7 +45,7 @@
 
 @frappe.whitelist()
 def get_default_holiday_list():
-	return frappe.db.get_value("Company", frappe.defaults.get_user_default("Company"), "default_holiday_list")
+	return frappe.get_cached_value('Company',  frappe.defaults.get_user_default("Company"),  "default_holiday_list")
 
 def check_if_within_operating_hours(workstation, operation, from_datetime, to_datetime):
 	if from_datetime and to_datetime:
diff --git a/erpnext/patches/v10_0/set_currency_in_pricing_rule.py b/erpnext/patches/v10_0/set_currency_in_pricing_rule.py
index c01b2af..c413931 100644
--- a/erpnext/patches/v10_0/set_currency_in_pricing_rule.py
+++ b/erpnext/patches/v10_0/set_currency_in_pricing_rule.py
@@ -7,6 +7,6 @@
 	currency = frappe.db.get_default("currency")
 	for doc in frappe.get_all('Pricing Rule', fields = ["company", "name"]):
 		if doc.company:
-			currency = frappe.db.get_value("Company", doc.company, "default_currency")
+			currency = frappe.get_cached_value('Company',  doc.company,  "default_currency")
 
 		frappe.db.sql("""update `tabPricing Rule` set currency = %s where name = %s""",(currency, doc.name))
diff --git a/erpnext/patches/v10_0/update_address_template_for_india.py b/erpnext/patches/v10_0/update_address_template_for_india.py
index 5897b43..cb2b159 100644
--- a/erpnext/patches/v10_0/update_address_template_for_india.py
+++ b/erpnext/patches/v10_0/update_address_template_for_india.py
@@ -6,7 +6,7 @@
 from erpnext.regional.india.setup import update_address_template
 
 def execute():
-	if frappe.db.get_value('Company', {'country': 'India'}, 'name'):
+	if frappe.get_cached_value('Company',  {'country': 'India'},  'name'):
 		address_template = frappe.db.get_value('Address Template', 'India', 'template')
 		if not address_template or "gstin" not in address_template:
 			update_address_template()
diff --git a/erpnext/patches/v4_2/party_model.py b/erpnext/patches/v4_2/party_model.py
index 6f93352..46d7fff 100644
--- a/erpnext/patches/v4_2/party_model.py
+++ b/erpnext/patches/v4_2/party_model.py
@@ -56,7 +56,7 @@
 	parent_account = None
 	
 	if "receivables_group" in frappe.db.get_table_columns("Company"):
-		parent_account = frappe.db.get_value("Company", company,
+		parent_account = frappe.get_cached_value('Company',  company, 
 			"receivables_group" if master_type=="Customer" else "payables_group")
 	if not parent_account:
 		parent_account = frappe.db.get_value("Account", {"company": company,
diff --git a/erpnext/patches/v7_0/create_warehouse_nestedset.py b/erpnext/patches/v7_0/create_warehouse_nestedset.py
index ca47ac5..1c9fc32 100644
--- a/erpnext/patches/v7_0/create_warehouse_nestedset.py
+++ b/erpnext/patches/v7_0/create_warehouse_nestedset.py
@@ -31,7 +31,7 @@
 		sle_against_companies = frappe.db.sql_list("""select distinct company from `tabStock Ledger Entry`""")
 
 		if len(sle_against_companies) == 1:
-			company = frappe.db.get_value("Company", sle_against_companies[0], 
+			company = frappe.get_cached_value('Company',  sle_against_companies[0],  
 				fieldname=["name", "abbr"], as_dict=1)
 			set_company_to_warehouse(company.name)
 			make_warehouse_nestedset(company)
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index 2912ab9..9440aff 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -111,8 +111,8 @@
 	out.taxes = get_taxes_and_charges(master_doctype, default_tax)
 
 def calculate_annual_eligible_hra_exemption(doc):
-	basic_component = frappe.db.get_value("Company", doc.company, "basic_component")
-	hra_component = frappe.db.get_value("Company", doc.company, "hra_component")
+	basic_component = frappe.get_cached_value('Company',  doc.company,  "basic_component")
+	hra_component = frappe.get_cached_value('Company',  doc.company,  "hra_component")
 	annual_exemption, monthly_exemption, hra_amount = 0, 0, 0
 	if hra_component and basic_component:
 		assignment = get_salary_assignment(doc.employee, getdate())
diff --git "a/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.py" "b/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.py"
index eb4cbf8..a072ed0 100644
--- "a/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.py"
+++ "b/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.py"
@@ -33,7 +33,7 @@
 
 def set_account_currency(filters):
 
-	filters["company_currency"] = frappe.db.get_value("Company", filters.company, "default_currency")
+	filters["company_currency"] = frappe.get_cached_value('Company',  filters.company,  "default_currency")
 
 	return filters
 
@@ -100,7 +100,7 @@
 def get_result_as_list(data, filters):
 	result = []
 
-	company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
+	company_currency = frappe.get_cached_value('Company',  filters.company,  "default_currency")
 	accounts = frappe.get_all("Account", filters={"Company": filters.company}, fields=["name", "account_number"])
 
 	for d in data:
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 2c22543..fc88bf8 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -322,7 +322,7 @@
 			credit_limit = frappe.db.get_value("Customer Group", customer_group, "credit_limit")
 
 	if not credit_limit:
-		credit_limit = frappe.db.get_value("Company", company, "credit_limit")
+		credit_limit = frappe.get_cached_value('Company',  company,  "credit_limit")
 
 	return flt(credit_limit)
 
diff --git a/erpnext/selling/doctype/installation_note/installation_note.py b/erpnext/selling/doctype/installation_note/installation_note.py
index 9f730f4..ffcbb2d 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.py
+++ b/erpnext/selling/doctype/installation_note/installation_note.py
@@ -33,8 +33,8 @@
 		self.validate_installation_date()
 		self.check_item_table()
 
-		from erpnext.controllers.selling_controller import check_active_sales_items
-		check_active_sales_items(self)
+		from erpnext.controllers.selling_controller import set_default_income_account_for_item
+		set_default_income_account_for_item(self)
 
 	def is_serial_no_added(self, item_code, serial_no):
 		has_serial_no = frappe.db.get_value("Item", item_code, "has_serial_no")
diff --git a/erpnext/selling/doctype/pos_closing_voucher/pos_closing_voucher.py b/erpnext/selling/doctype/pos_closing_voucher/pos_closing_voucher.py
index a4a6e86..e7fc85e 100644
--- a/erpnext/selling/doctype/pos_closing_voucher/pos_closing_voucher.py
+++ b/erpnext/selling/doctype/pos_closing_voucher/pos_closing_voucher.py
@@ -157,7 +157,7 @@
 	return {'net_total': net_total, 'grand_total': grand_total, 'total_qty': total_qty}
 
 def get_company_currency(doc):
-	currency = frappe.db.get_value("Company", doc.company, "default_currency")
+	currency = frappe.get_cached_value('Company',  doc.company,  "default_currency")
 	return frappe.get_doc('Currency', currency)
 
 def get_invoices(filters):
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 85b10dd..94be33c 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -75,7 +75,7 @@
 							.format(self.get(field), self.name))
 
 	def validate_currency(self):
-		self.previous_default_currency = frappe.db.get_value("Company", self.name, "default_currency")
+		self.previous_default_currency = frappe.get_cached_value('Company',  self.name,  "default_currency")
 		if self.default_currency and self.previous_default_currency and \
 			self.default_currency != self.previous_default_currency and \
 			self.check_if_transactions_exist():
@@ -161,7 +161,7 @@
 		frappe.flags.country_change = False
 
 		if not self.get('__islocal') and \
-			self.country != frappe.db.get_value('Company', self.name, 'country'):
+			self.country != frappe.get_cached_value('Company',  self.name,  'country'):
 			frappe.flags.country_change = True
 
 	def set_default_accounts(self):
@@ -361,7 +361,7 @@
 
 
 def get_name_with_abbr(name, company):
-	company_abbr = frappe.db.get_value("Company", company, "abbr")
+	company_abbr = frappe.get_cached_value('Company',  company,  "abbr")
 	parts = name.split(" - ")
 
 	if parts[-1].lower() != company_abbr.lower():
@@ -505,7 +505,7 @@
 	out = {}
 	date_to_value_dict = {}
 
-	history = frappe.db.get_value("Company", name, "transactions_annual_history")
+	history = frappe.get_cached_value('Company',  name,  "transactions_annual_history")
 
 	try:
 		date_to_value_dict = json.loads(history) if history and '{' in history else None
@@ -514,7 +514,7 @@
 
 	if date_to_value_dict is None:
 		update_transactions_annual_history(name, True)
-		history = frappe.db.get_value("Company", name, "transactions_annual_history")
+		history = frappe.get_cached_value('Company',  name,  "transactions_annual_history")
 		return json.loads(history) if history and '{' in history else {}
 
 	return date_to_value_dict
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index c9ebada..3ca022d 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -22,7 +22,7 @@
 		self.from_date, self.to_date = self.get_from_to_date()
 		self.set_dates()
 		self._accounts = {}
-		self.currency = frappe.db.get_value("Company", self.company, "default_currency")
+		self.currency = frappe.get_cached_value('Company',  self.company,  "default_currency")
 
 	def get_users(self):
 		"""get list of users"""
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index 7783d12..dd11029 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -177,8 +177,8 @@
 def get_item_group_defaults(item, company):
 	item = frappe.get_cached_doc("Item", item)
 	item_group = frappe.get_cached_doc("Item Group", item.item_group)
-	
-	for d in item_group.item_defaults:
+
+	for d in item_group.item_group_defaults or []:
 		if d.company == company:
 			return d.as_dict()
 
diff --git a/erpnext/setup/setup_wizard/operations/taxes_setup.py b/erpnext/setup/setup_wizard/operations/taxes_setup.py
index dd5c037..82f7512 100644
--- a/erpnext/setup/setup_wizard/operations/taxes_setup.py
+++ b/erpnext/setup/setup_wizard/operations/taxes_setup.py
@@ -51,7 +51,7 @@
 			}).insert(ignore_permissions=True, ignore_mandatory=True)
 		except frappe.NameError:
 			frappe.message_log.pop()
-			abbr = frappe.db.get_value('Company', company, 'abbr')
+			abbr = frappe.get_cached_value('Company',  company,  'abbr')
 			account = '{0} - {1}'.format(account_name, abbr)
 			return frappe.get_doc('Account', account)
 
diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
index 5c24070..be4670e 100644
--- a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
+++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
@@ -22,7 +22,7 @@
 
 	def validate_exchange_rates_exist(self):
 		"""check if exchange rates exist for all Price List currencies (to company's currency)"""
-		company_currency = frappe.db.get_value("Company", self.company, "default_currency")
+		company_currency = frappe.get_cached_value('Company',  self.company,  "default_currency")
 		if not company_currency:
 			msgprint(_("Please specify currency in Company") + ": " + self.company,
 				raise_exception=ShoppingCartSetupError)
diff --git a/erpnext/stock/__init__.py b/erpnext/stock/__init__.py
index 8ef1415..331472a 100644
--- a/erpnext/stock/__init__.py
+++ b/erpnext/stock/__init__.py
@@ -51,4 +51,4 @@
 	return account
 	
 def get_company_default_inventory_account(company):
-	return frappe.db.get_value('Company', company, 'default_inventory_account')
\ No newline at end of file
+	return frappe.get_cached_value('Company',  company,  'default_inventory_account')
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 74fd42c..e4ca052 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -937,6 +937,20 @@
 
 	return out
 
+def set_item_default(item_code, company, fieldname, value):
+	item = frappe.get_cached_doc('Item', item_code)
+
+	for d in item.item_defaults:
+		if d.company == company:
+			if not d.get(fieldname):
+				frappe.db.set_value(d.doctype, d.name, fieldname, value)
+			return
+
+	# no row found, add a new row for the company
+	d = item.append('item_defaults', {fieldname: value, company: company})
+	d.db_insert()
+	item.clear_cache()
+
 @frappe.whitelist()
 def get_uom_conv_factor(uom, stock_uom):
 	uoms = [uom, stock_uom]
diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
index d36b6cf..a647717 100644
--- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
+++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
@@ -46,10 +46,10 @@
 		if not self.get("purchase_receipts"):
 			frappe.throw(_("Please enter Receipt Document"))
 
-		
+
 	def validate_purchase_receipts(self):
 		receipt_documents = []
-		
+
 		for d in self.get("purchase_receipts"):
 			if frappe.db.get_value(d.receipt_document_type, d.receipt_document, "docstatus") != 1:
 				frappe.throw(_("Receipt document must be submitted"))
@@ -72,16 +72,16 @@
 
 	def validate_applicable_charges_for_item(self):
 		based_on = self.distribute_charges_based_on.lower()
-		
+
 		total = sum([flt(d.get(based_on)) for d in self.get("items")])
-		
+
 		if not total:
 			frappe.throw(_("Total {0} for all items is zero, may be you should change 'Distribute Charges Based On'").format(based_on))
-		
+
 		total_applicable_charges = sum([flt(d.applicable_charges) for d in self.get("items")])
 
 		precision = get_field_precision(frappe.get_meta("Landed Cost Item").get_field("applicable_charges"),
-		currency=frappe.db.get_value("Company", self.company, "default_currency", cache=True))
+		currency=frappe.get_cached_value('Company',  self.company,  "default_currency"))
 
 		diff = flt(self.total_taxes_and_charges) - flt(total_applicable_charges)
 		diff = flt(diff, precision)
diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
index 86ff2ee..e196764 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -377,7 +377,7 @@
 		"serial_no": args.serial_no,
 		"stock_uom": args.stock_uom or "_Test UOM",
 		"uom": args.uom or "_Test UOM",
-		"cost_center": args.cost_center or frappe.db.get_value('Company', pr.company, 'cost_center'),
+		"cost_center": args.cost_center or frappe.get_cached_value('Company',  pr.company,  'cost_center'),
 		"asset_location": args.location or "Test Location"
 	})
 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 13cfb69..687790b 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -623,14 +623,14 @@
 			["Cost Center", "cost_center", "cost_center"]]:
 				company = frappe.db.get_value(d[0], ret.get(d[1]), "company")
 				if not ret[d[1]] or (company and self.company != company):
-					ret[d[1]] = frappe.db.get_value("Company", self.company, d[2]) if d[2] else None
+					ret[d[1]] = frappe.get_cached_value('Company',  self.company,  d[2]) if d[2] else None
 
 		# update uom
 		if args.get("uom") and for_update:
 			ret.update(get_uom_details(args.get('item_code'), args.get('uom'), args.get('qty')))
 
 		if not ret["expense_account"]:
-			ret["expense_account"] = frappe.db.get_value("Company", self.company, "stock_adjustment_account")
+			ret["expense_account"] = frappe.get_cached_value('Company',  self.company,  "stock_adjustment_account")
 
 		args['posting_date'] = self.posting_date
 		args['posting_time'] = self.posting_time
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
index bd3577f..43a66a8 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -21,9 +21,9 @@
 
 	def validate(self):
 		if not self.expense_account:
-			self.expense_account = frappe.db.get_value("Company", self.company, "stock_adjustment_account")
+			self.expense_account = frappe.get_cached_value('Company',  self.company,  "stock_adjustment_account")
 		if not self.cost_center:
-			self.cost_center = frappe.db.get_value("Company", self.company, "cost_center")
+			self.cost_center = frappe.get_cached_value('Company',  self.company,  "cost_center")
 		self.validate_posting_time()
 		self.remove_items_with_no_change()
 		self.validate_data()
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index 3ea2939..850d648 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -14,7 +14,7 @@
 
 	def autoname(self):
 		if self.company:
-			suffix = " - " + frappe.db.get_value("Company", self.company, "abbr")
+			suffix = " - " + frappe.get_cached_value('Company',  self.company,  "abbr")
 			if not self.warehouse_name.endswith(suffix):
 				self.name = self.warehouse_name + suffix
 		else:
@@ -87,7 +87,7 @@
 			self.recalculate_bin_qty(new_name)
 
 	def get_new_warehouse_name_without_abbr(self, name):
-		company_abbr = frappe.db.get_value("Company", self.company, "abbr")
+		company_abbr = frappe.get_cached_value('Company',  self.company,  "abbr")
 		parts = name.rsplit(" - ", 1)
 
 		if parts[-1].lower() == company_abbr.lower():
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index da92608..5c61035 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -39,34 +39,18 @@
 		}
 	"""
 	args = process_args(args)
-	item_doc = frappe.get_doc("Item", args.item_code)
-	item = item_doc
-
+	item = frappe.get_cached_doc("Item", args.item_code)
 	validate_item_details(args, item)
 
 	out = get_basic_details(args, item)
 
-	get_party_item_code(args, item_doc, out)
+	get_party_item_code(args, item, out)
 
-	if frappe.db.exists("Product Bundle", args.item_code):
-		valuation_rate = 0.0
-		bundled_items = frappe.get_doc("Product Bundle", args.item_code)
-
-		for bundle_item in bundled_items.items:
-			valuation_rate += \
-				flt(get_valuation_rate(bundle_item.item_code, args.company, out.get("warehouse")).get("valuation_rate") \
-					* bundle_item.qty)
-
-		out.update({
-			"valuation_rate": valuation_rate
-		})
-
-	else:
-		out.update(get_valuation_rate(args.item_code, args.company, out.get("warehouse")))
+	set_valuation_rate(out, args)
 
 	update_party_blanket_order(args, out)
 
-	get_price_list_rate(args, item_doc, out)
+	get_price_list_rate(args, item, out)
 
 	if args.customer and cint(args.is_pos):
 		out.update(get_pos_profile_item_details(args.company, args))
@@ -80,6 +64,24 @@
 			args[key] = value
 
 	out.update(get_pricing_rule_for_item(args))
+
+	update_stock(args, out)
+
+	if args.transaction_date and item.lead_time_days:
+		out.schedule_date = out.lead_time_date = add_days(args.transaction_date,
+			item.lead_time_days)
+
+	if args.get("is_subcontracted") == "Yes":
+		out.bom = args.get('bom') or get_default_bom(args.item_code)
+
+	get_gross_profit(out)
+	if args.doctype == 'Material Request':
+		out.rate = args.rate or out.price_list_rate
+		out.amount = flt(args.qty * out.rate)
+
+	return out
+
+def update_stock(args, out):
 	if (args.get("doctype") == "Delivery Note" or
 		(args.get("doctype") == "Sales Invoice" and args.get('update_stock'))) \
 		and out.warehouse and out.stock_qty > 0:
@@ -99,19 +101,24 @@
 			reserved_so = get_so_reservation_for_item(args)
 			out.serial_no = get_serial_no(out, args.serial_no, sales_order=reserved_so)
 
-	if args.transaction_date and item.lead_time_days:
-		out.schedule_date = out.lead_time_date = add_days(args.transaction_date,
-			item.lead_time_days)
 
-	if args.get("is_subcontracted") == "Yes":
-		out.bom = args.get('bom') or get_default_bom(args.item_code)
+def set_valuation_rate(out, args):
+	if frappe.db.exists("Product Bundle", args.item_code):
+		valuation_rate = 0.0
+		bundled_items = frappe.get_doc("Product Bundle", args.item_code)
 
-	get_gross_profit(out)
-	if args.doctype == 'Material Request':
-		out.rate = args.rate or out.price_list_rate
-		out.amount = flt(args.qty * out.rate)
+		for bundle_item in bundled_items.items:
+			valuation_rate += \
+				flt(get_valuation_rate(bundle_item.item_code, args.company, out.get("warehouse")).get("valuation_rate") \
+					* bundle_item.qty)
 
-	return out
+		out.update({
+			"valuation_rate": valuation_rate
+		})
+
+	else:
+		out.update(get_valuation_rate(args.item_code, args.company, out.get("warehouse")))
+
 
 def process_args(args):
 	if isinstance(args, string_types):
@@ -215,10 +222,9 @@
 	warehouse = user_default_warehouse or item_defaults.get("default_warehouse") or\
 		item_group_defaults.get("default_warehouse") or args.warehouse
 
-	material_request_type = ''
 	if args.get('doctype') == "Material Request" and not args.get('material_request_type'):
 		args['material_request_type'] = frappe.db.get_value('Material Request',
-			args.get('name'), 'material_request_type')
+			args.get('name'), 'material_request_type', cache=True)
 
 	#Set the UOM to the Default Sales UOM or Default Purchase UOM if configured in the Item Master
 	if not args.uom:
@@ -297,7 +303,7 @@
 		["Cost Center", "cost_center", "cost_center"],
 		["Warehouse", "warehouse", ""]]:
 			if not out[d[1]]:
-				out[d[1]] = frappe.db.get_value("Company", args.company, d[2]) if d[2] else None
+				out[d[1]] = frappe.get_cached_value('Company',  args.company,  d[2]) if d[2] else None
 
 	for fieldname in ("item_name", "item_group", "barcodes", "brand", "stock_uom"):
 		out[fieldname] = item.get(fieldname)
@@ -319,12 +325,12 @@
 	if item.enable_deferred_revenue:
 		return (item.deferred_revenue_account
 			or args.deferred_revenue_account
-			or frappe.db.get_value("Company", args.company, "default_deferred_revenue_account"))
+			or frappe.get_cached_value('Company',  args.company,  "default_deferred_revenue_account"))
 	else:
 		return None
 
 def get_default_cost_center(args, item, item_group):
-	return (frappe.db.get_value("Project", args.get("project"), "cost_center")
+	return (frappe.db.get_value("Project", args.get("project"), "cost_center", cache=True)
 		or (item.get("selling_cost_center") if args.get("customer") else item.get("buying_cost_center"))
 		or (item_group.get("selling_cost_center") if args.get("customer") else item_group.get("buying_cost_center"))
 		or args.get("cost_center"))
@@ -363,20 +369,12 @@
 
 def insert_item_price(args):
 	"""Insert Item Price if Price List and Price List Rate are specified and currency is the same"""
-	if frappe.db.get_value("Price List", args.price_list, "currency") == args.currency \
+	if frappe.db.get_value("Price List", args.price_list, "currency", cache=True) == args.currency \
 		and cint(frappe.db.get_single_value("Stock Settings", "auto_insert_price_list_rate_if_missing")):
 		if frappe.has_permission("Item Price", "write"):
 			price_list_rate = (args.rate / args.get('conversion_factor')
 				if args.get("conversion_factor") else args.rate)
 
-			item_price = frappe.get_doc({
-				"doctype": "Item Price",
-				"price_list": args.price_list,
-				"item_code": args.item_code,
-				"currency": args.currency,
-				"price_list_rate": price_list_rate
-			})
-
 			name = frappe.db.get_value('Item Price',
 				{'item_code': args.item_code, 'price_list': args.price_list, 'currency': args.currency}, 'name')
 
@@ -387,6 +385,13 @@
 				frappe.msgprint(_("Item Price updated for {0} in Price List {1}").format(args.item_code,
 					args.price_list))
 			else:
+				item_price = frappe.get_doc({
+					"doctype": "Item Price",
+					"price_list": args.price_list,
+					"item_code": args.item_code,
+					"currency": args.currency,
+					"price_list_rate": price_list_rate
+				})
 				item_price.insert()
 				frappe.msgprint(_("Item Price added for {0} in Price List {1}").format(args.item_code,
 					args.price_list))
@@ -501,7 +506,7 @@
 	from erpnext.controllers.accounts_controller import validate_conversion_rate
 
 	if (not args.conversion_rate
-		and args.currency==frappe.db.get_value("Company", args.company, "default_currency")):
+		and args.currency==frappe.get_cached_value('Company',  args.company,  "default_currency")):
 		args.conversion_rate = 1.0
 
 	# validate currency conversion rate
@@ -513,7 +518,7 @@
 			frappe._dict({"fields": args})))
 
 	if (not args.plc_conversion_rate
-		and args.price_list_currency==frappe.db.get_value("Price List", args.price_list, "currency")):
+		and args.price_list_currency==frappe.db.get_value("Price List", args.price_list, "currency", cache=True)):
 		args.plc_conversion_rate = 1.0
 
 	# validate price list currency conversion rate
@@ -535,7 +540,7 @@
 		if customer_item_code:
 			out.customer_item_code = customer_item_code[0].ref_code
 		else:
-			customer_group = frappe.db.get_value("Customer", args.customer, "customer_group")
+			customer_group = frappe.db.get_value("Customer", args.customer, "customer_group", cache=True)
 			customer_group_item_code = item_doc.get("customer_items", {"customer_group": customer_group})
 			if customer_group_item_code and not customer_group_item_code[0].customer_name:
 				out.customer_item_code = customer_group_item_code[0].ref_code
@@ -547,8 +552,8 @@
 def get_pos_profile_item_details(company, args, pos_profile=None, update_data=False):
 	res = frappe._dict()
 
-	if not pos_profile:
-		pos_profile = get_pos_profile(company, args.get('pos_profile'))
+	if not frappe.flags.pos_profile and not pos_profile:
+		pos_profile = frappe.flags.pos_profile = get_pos_profile(company, args.get('pos_profile'))
 
 	if pos_profile:
 		for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"):
@@ -564,7 +569,7 @@
 @frappe.whitelist()
 def get_pos_profile(company, pos_profile=None, user=None):
 	if pos_profile:
-		return frappe.get_doc('POS Profile', pos_profile)
+		return frappe.get_cached_doc('POS Profile', pos_profile)
 
 	if not user:
 		user = frappe.session['user']
@@ -618,7 +623,7 @@
 
 @frappe.whitelist()
 def get_conversion_factor(item_code, uom):
-	variant_of = frappe.db.get_value("Item", item_code, "variant_of")
+	variant_of = frappe.db.get_value("Item", item_code, "variant_of", cache=True)
 	filters = {"parent": item_code, "uom": uom}
 	if variant_of:
 		filters["parent"] = ("in", (item_code, variant_of))
@@ -633,7 +638,7 @@
 @frappe.whitelist()
 def get_bin_details(item_code, warehouse):
 	return frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse},
-			["projected_qty", "actual_qty"], as_dict=True) \
+			["projected_qty", "actual_qty"], as_dict=True, cache=True) \
 			or {"projected_qty": 0, "actual_qty": 0}
 
 @frappe.whitelist()
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index 37caf47..928dd88 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -100,7 +100,7 @@
 
 		self.company = frappe.db.get_value("Warehouse", self.warehouse, "company")
 		self.precision = get_field_precision(frappe.get_meta("Stock Ledger Entry").get_field("stock_value"),
-			currency=frappe.db.get_value("Company", self.company, "default_currency", cache=True))
+			currency=frappe.get_cached_value('Company',  self.company,  "default_currency"))
 
 		self.prev_stock_value = self.previous_sle.stock_value or 0.0
 		self.stock_queue = json.loads(self.previous_sle.stock_queue or "[]")
diff --git a/erpnext/templates/pages/rfq.py b/erpnext/templates/pages/rfq.py
index aaf4110..62ec609 100644
--- a/erpnext/templates/pages/rfq.py
+++ b/erpnext/templates/pages/rfq.py
@@ -40,9 +40,9 @@
 
 def update_supplier_details(context):
 	supplier_doc = frappe.get_doc("Supplier", context.doc.supplier)
-	context.doc.currency = supplier_doc.default_currency or frappe.db.get_value("Company", context.doc.company, "default_currency")
-	context.doc.currency_symbol = frappe.db.get_value("Currency", context.doc.currency, "symbol")
-	context.doc.number_format = frappe.db.get_value("Currency", context.doc.currency, "number_format")
+	context.doc.currency = supplier_doc.default_currency or frappe.get_cached_value('Company',  context.doc.company,  "default_currency")
+	context.doc.currency_symbol = frappe.db.get_value("Currency", context.doc.currency, "symbol", cache=True)
+	context.doc.number_format = frappe.db.get_value("Currency", context.doc.currency, "number_format", cache=True)
 	context.doc.buying_price_list = supplier_doc.default_price_list or ''
 
 def get_link_quotation(supplier, rfq):
diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py
index 0f641b2..7912a59 100644
--- a/erpnext/utilities/__init__.py
+++ b/erpnext/utilities/__init__.py
@@ -27,7 +27,7 @@
 		company = company[0][0] if company else None
 
 	if company:
-		domain = frappe.db.get_value('Company', cstr(company), 'domain')
+		domain = frappe.get_cached_value('Company',  cstr(company),  'domain')
 
 	return {
 		'company': company,
diff --git a/erpnext/utilities/activation.py b/erpnext/utilities/activation.py
index b694ea6..8ad042b 100644
--- a/erpnext/utilities/activation.py
+++ b/erpnext/utilities/activation.py
@@ -54,7 +54,7 @@
 	if get_level() > 6:
 		return []
 
-	domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
+	domain = frappe.get_cached_value('Company',  erpnext.get_default_company(),  'domain')
 	messages = []
 
 	message_settings = [
diff --git a/erpnext/utilities/product.py b/erpnext/utilities/product.py
index 02b0dfa..6f984a5 100644
--- a/erpnext/utilities/product.py
+++ b/erpnext/utilities/product.py
@@ -20,10 +20,10 @@
 
 	if warehouse:
 		stock_qty = frappe.db.sql("""
-			select GREATEST(S.actual_qty - S.reserved_qty - S.reserved_qty_for_production - S.reserved_qty_for_sub_contract, 0) / IFNULL(C.conversion_factor, 1) 
+			select GREATEST(S.actual_qty - S.reserved_qty - S.reserved_qty_for_production - S.reserved_qty_for_sub_contract, 0) / IFNULL(C.conversion_factor, 1)
 			from tabBin S
 			inner join `tabItem` I on S.item_code = I.Item_code
-			left join `tabUOM Conversion Detail` C on I.sales_uom = C.uom and C.parent = I.Item_code 
+			left join `tabUOM Conversion Detail` C on I.sales_uom = C.uom and C.parent = I.Item_code
 			where S.item_code=%s and S.warehouse=%s""", (item_code, warehouse))
 
 		if stock_qty:
@@ -37,7 +37,7 @@
 	batches = frappe.get_all('Batch', filters=[{'item': item_code}], fields=['expiry_date', 'name'])
 	expired_batches = get_expired_batches(batches)
 	stock_qty = [list(item) for item in stock_qty]
-	
+
 	for batch in expired_batches:
 		if warehouse:
 			stock_qty[0][0] = max(0, stock_qty[0][0] - get_batch_qty(batch, warehouse))
@@ -103,7 +103,7 @@
 				price_obj["formatted_price"] = fmt_money(price_obj["price_list_rate"], currency=price_obj["currency"])
 
 				price_obj["currency_symbol"] = not cint(frappe.db.get_default("hide_currency_symbol")) \
-					and (frappe.db.get_value("Currency", price_obj.currency, "symbol") or price_obj.currency) \
+					and (frappe.db.get_value("Currency", price_obj.currency, "symbol", cache=True) or price_obj.currency) \
 					or ""
 
 				uom_conversion_factor = frappe.db.sql("""select	C.conversion_factor
diff --git a/erpnext/utilities/user_progress.py b/erpnext/utilities/user_progress.py
index ae156b8..2901d52 100644
--- a/erpnext/utilities/user_progress.py
+++ b/erpnext/utilities/user_progress.py
@@ -7,7 +7,7 @@
 
 def get_slide_settings():
 	defaults = frappe.defaults.get_defaults()
-	domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
+	domain = frappe.get_cached_value('Company',  erpnext.get_default_company(),  'domain')
 	company = defaults.get("company") or ''
 	currency = defaults.get("currency") or ''
 
diff --git a/erpnext/utilities/user_progress_utils.py b/erpnext/utilities/user_progress_utils.py
index 0377a0a..a665c5d 100644
--- a/erpnext/utilities/user_progress_utils.py
+++ b/erpnext/utilities/user_progress_utils.py
@@ -234,6 +234,6 @@
 
 @frappe.whitelist()
 def update_default_domain_actions_and_get_state():
-	domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
+	domain = frappe.get_cached_value('Company',  erpnext.get_default_company(),  'domain')
 	update_domain_actions(domain)
 	return get_domain_actions_state(domain)