fix: not able to import chart of account if parent account is missing (#20368)

This commit is contained in:
rohitwaghchaure 2020-01-21 15:32:26 +05:30 committed by Nabin Hait
parent eea0ffcb38
commit 5056c8bcb4

View File

@ -96,7 +96,11 @@ def build_forest(data):
if parent_account == account_name == child:
return [parent_account]
elif account_name == child:
return [child] + return_parent(data, parent_account)
parent_account_list = return_parent(data, parent_account)
if not parent_account_list:
frappe.throw(_("The parent account {0} does not exists")
.format(parent_account))
return [child] + parent_account_list
charts_map, paths = {}, []