Merge branch 'master' of git://github.com/akhileshdarjee/erpnext into akhileshdarjee-master

Conflicts:
	accounts/doctype/pos_setting/pos_setting.txt
	patches/patch_list.py
diff --git a/patches/august_2013/p03_pos_setting_replace_customer_account.py b/patches/august_2013/p03_pos_setting_replace_customer_account.py
new file mode 100644
index 0000000..c3a21e4
--- /dev/null
+++ b/patches/august_2013/p03_pos_setting_replace_customer_account.py
@@ -0,0 +1,24 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import webnotes
+
+def execute():
+	webnotes.reload_doc("accounts", "doctype", "pos_setting")
+	if "customer_account" in webnotes.conn.get_table_columns("POS Setting"):
+		customer_account = webnotes.conn.sql("""select customer_account, name from `tabPOS Setting` 
+			where ifnull(customer_account, '')!=''""")
+
+		for cust_acc, pos_name in customer_account:
+			customer = webnotes.conn.sql("""select master_name, account_name from `tabAccount` 
+				where name=%s""", (cust_acc), as_dict=1)
+
+			if not customer[0].master_name:
+				customer_name = webnotes.conn.get_value('Customer', customer[0].account_name, 'name')
+			else:
+				customer_name = customer[0].master_name
+
+			webnotes.conn.set_value('POS Setting', pos_name, 'customer', customer_name)
+		
+		webnotes.conn.sql_ddl("""alter table `tabPOS Setting` drop column `customer_account`""")
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 95b10b7..bd6b9a3 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -253,4 +253,5 @@
 	"execute:webnotes.bean('Selling Settings').save() #2013-07-29",
 	"patches.august_2013.p01_hr_settings",
 	"patches.august_2013.p02_rename_price_list",
+	"patches.august_2013.p03_pos_setting_replace_customer_account",
 ]
\ No newline at end of file