From 44aaa56000f7931698652e8b9d1422bbffb7ff64 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 20 Apr 2015 11:51:16 +0530 Subject: [PATCH] get standard chart of account if country code not found --- .../account/chart_of_accounts/chart_of_accounts.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py index a2995c9163..a27d739fae 100644 --- a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py +++ b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py @@ -85,11 +85,12 @@ def get_charts_for_country(country): charts.append(content["name"]) country_code = frappe.db.get_value("Country", country, "code") - path = os.path.join(os.path.dirname(__file__), "verified") - for fname in os.listdir(path): - if fname.startswith(country_code) and fname.endswith(".json"): - with open(os.path.join(path, fname), "r") as f: - _get_chart_name(f.read()) + if country_code: + path = os.path.join(os.path.dirname(__file__), "verified") + for fname in os.listdir(path): + if fname.startswith(country_code) and fname.endswith(".json"): + with open(os.path.join(path, fname), "r") as f: + _get_chart_name(f.read()) countries_use_OHADA_system = ["Benin", "Burkina Faso", "Cameroon", "Central African Republic", "Comoros", "Congo", "Ivory Coast", "Gabon", "Guinea", "Guinea Bissau", "Equatorial Guinea", "Mali", "Niger",