[minor] chart_of_accounts.py for python3
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 845949b..919f53b 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
@@ -44,9 +44,9 @@
if root_account or frappe.local.flags.allow_unverified_charts:
account.flags.ignore_mandatory = True
-
+
account.flags.ignore_permissions = True
-
+
account.insert()
accounts.append(account_name_in_db)
@@ -82,7 +82,7 @@
chart = {}
if existing_company:
return get_account_tree_from_existing_company(existing_company)
-
+
elif chart_template == "Standard":
from erpnext.accounts.doctype.account.chart_of_accounts.verified import standard_chart_of_accounts
return standard_chart_of_accounts.get()
@@ -123,6 +123,8 @@
for folder in folders:
path = os.path.join(os.path.dirname(__file__), folder)
+ if not os.path.exists(path):
+ continue
for fname in os.listdir(path):
fname = frappe.as_unicode(fname)
@@ -130,6 +132,7 @@
with open(os.path.join(path, fname), "r") as f:
_get_chart_name(f.read())
+ # if more than one charts, returned then add the standard
if len(charts) != 1 or with_standard:
charts += ["Standard", "Standard with Numbers"]
@@ -154,7 +157,7 @@
# find children
parent_account = parent.name if parent else ""
children = [acc for acc in all_accounts if cstr(acc.parent_account) == parent_account]
-
+
# if no children, but a group account
if not children and parent.is_group:
tree["is_group"] = 1
@@ -164,7 +167,7 @@
for child in children:
# start new subtree
tree[child.account_name] = {}
-
+
# assign account_type and root_type
if child.account_number:
tree[child.account_name]["account_number"] = child.account_number
@@ -174,7 +177,7 @@
tree[child.account_name]["tax_rate"] = child.tax_rate
if not parent:
tree[child.account_name]["root_type"] = child.root_type
-
+
# call recursively to build a subtree for current account
build_account_tree(tree[child.account_name], child, all_accounts)
@@ -182,7 +185,7 @@
def validate_bank_account(coa, bank_account):
accounts = []
chart = get_chart(coa)
-
+
if chart:
def _get_account_names(account_master):
for account_name, child in iteritems(account_master):