diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 7bdff4d9ea8..f651ea49525 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 00000000000..9a4ddcb28ad --- /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 b79e5ca0934..612adf84ecc 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