Merge branch 'master' of https://github.com/webnotes/erpnext

Conflicts:
	controllers/buying_controller.py
diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py
index cd40d61..ac6481c 100644
--- a/controllers/accounts_controller.py
+++ b/controllers/accounts_controller.py
@@ -18,6 +18,7 @@
 import webnotes
 from webnotes import msgprint, _
 from webnotes.utils import flt
+
 from utilities.transaction_base import TransactionBase
 
 class AccountsController(TransactionBase):
@@ -74,16 +75,15 @@
 				"advance_amount": flt(d.amount),
 				"allocate_amount": 0
 			})
-			
-	def get_stock_in_hand_account(self):
-		stock_in_hand_account = webnotes.conn.get_value("Company", self.doc.company, "stock_in_hand_account")
 		
-		if not stock_in_hand_account:
-			msgprint(_("Missing") + ": " 
-				+ _(webnotes.get_doctype("company").get_label("stock_in_hand_account")
-				+ " " + _("for Company") + " " + self.doc.company), raise_exception=True)
-		
-		return stock_in_hand_account
+	def get_default_account(self, account_for):
+		account = webnotes.conn.get_value("Company", self.doc.company, account_for)
+		if not account:
+			msgprint(_("Please mention default account for '") + 
+				_(webnotes.get_doctype("company").get_label(account_for) + 
+				_("' in Company: ") + self.doc.company), raise_exception=True)
+				
+		return account
 		
 	@property
 	def stock_items(self):
@@ -92,7 +92,7 @@
 			self._stock_items = [r[0] for r in webnotes.conn.sql("""select name
 				from `tabItem` where name in (%s) and is_stock_item='Yes'""" % \
 				(", ".join((["%s"]*len(item_codes))),), item_codes)]
-
+				
 		return self._stock_items
 		
 	@property
@@ -100,4 +100,9 @@
 		if not hasattr(self, "_abbr"):
 			self._abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
 			
-		return self._abbr
\ No newline at end of file
+		return self._abbr
+
+
+@webnotes.whitelist()
+def get_default_account(account_for, company):
+	return webnotes.conn.get_value("Company", company, account_for)