import chart records into database frm json
diff --git a/erpnext/accounts/doctype/chart_of_accounts/import_charts.py b/erpnext/accounts/doctype/chart_of_accounts/import_charts.py
new file mode 100644
index 0000000..c804955
--- /dev/null
+++ b/erpnext/accounts/doctype/chart_of_accounts/import_charts.py
@@ -0,0 +1,26 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe, os, json
+
+def import_charts():
+	frappe.db.sql("""delete from `tabChart of Accounts`""")
+	charts_dir = os.path.join(os.path.dirname(__file__), "charts")
+	for fname in os.listdir(charts_dir):
+		if fname.endswith(".json"):
+			with open(os.path.join(charts_dir, fname), "r") as f:
+				chart = json.loads(f.read())
+				country = frappe.db.get_value("Country", {"code": fname.split("_", 1)[0]})
+				if country:
+					bean = frappe.bean({
+						"doctype":"Chart of Accounts",
+						"chart_name": chart.get("name"),
+						"source_file": fname,
+						"country": country
+					}).insert()
+					print bean.doc.name
+				else:
+					print "No chart for: " + chart.get("name")
+				
+	frappe.db.commit()
\ No newline at end of file
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index eb851ab..a7707a1 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -8,6 +8,8 @@
 def after_install():
 	import_defaults()
 	import_country_and_currency()
+	from erpnext.accounts.doctype.chart_of_accounts.import_charts import import_charts
+	import_charts()
 	frappe.db.set_value('Control Panel', None, 'home_page', 'setup-wizard')
 	feature_setup()
 	from erpnext.setup.page.setup_wizard.setup_wizard import add_all_roles_to
@@ -24,6 +26,7 @@
 		frappe.doc({
 			"doctype": "Country",
 			"country_name": name,
+			"code": country.code,
 			"date_format": country.date_format or "dd-mm-yyyy",
 			"time_zones": "\n".join(country.timezones or [])
 		}).insert()