From a69c30edecc2d557dc68dc4a14761e2e46f0a045 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 6 Mar 2014 18:20:45 +0530 Subject: [PATCH] country code added --- erpnext/patches.txt | 1 + erpnext/patches/4_0/import_country_codes.py | 13 +++++++++++++ erpnext/setup/page/setup_wizard/setup_wizard.py | 1 + 3 files changed, 15 insertions(+) create mode 100644 erpnext/patches/4_0/import_country_codes.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 7bdff4d9ea..f651ea4952 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -29,3 +29,4 @@ erpnext.patches.4_0.remove_module_home_pages erpnext.patches.4_0.split_email_settings erpnext.patches.4_0.fix_employee_user_id erpnext.patches.4_0.set_account_details +erpnext.patches.4_0.import_country_codes diff --git a/erpnext/patches/4_0/import_country_codes.py b/erpnext/patches/4_0/import_country_codes.py new file mode 100644 index 0000000000..9a4ddcb28a --- /dev/null +++ b/erpnext/patches/4_0/import_country_codes.py @@ -0,0 +1,13 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# MIT License. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.reload_doc("setup", "doctype", "country") + + from frappe.country_info import get_all + + for name, country in get_all().iteritems(): + frappe.set_value("Country", name, "code", country.get("code")) \ No newline at end of file diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.py b/erpnext/setup/page/setup_wizard/setup_wizard.py index b79e5ca093..612adf84ec 100644 --- a/erpnext/setup/page/setup_wizard/setup_wizard.py +++ b/erpnext/setup/page/setup_wizard/setup_wizard.py @@ -88,6 +88,7 @@ def create_fiscal_year_and_company(args): 'company_name':args.get('company_name'), 'abbr':args.get('company_abbr'), 'default_currency':args.get('currency'), + 'country': args.get('country') }]).insert() args["curr_fiscal_year"] = curr_fiscal_year