Minor fix in creating chart of accounts based on existing (#8890)
This commit is contained in:
parent
4b544347a9
commit
08ea710c8f
@ -125,13 +125,14 @@ def get_account_tree_from_existing_company(existing_company):
|
|||||||
account_tree = {}
|
account_tree = {}
|
||||||
|
|
||||||
# fill in tree starting with root accounts (those with no parent)
|
# fill in tree starting with root accounts (those with no parent)
|
||||||
build_account_tree(account_tree, None, all_accounts)
|
if all_accounts:
|
||||||
|
build_account_tree(account_tree, None, all_accounts)
|
||||||
return account_tree
|
return account_tree
|
||||||
|
|
||||||
def build_account_tree(tree, parent, all_accounts):
|
def build_account_tree(tree, parent, all_accounts):
|
||||||
# find children
|
# find children
|
||||||
parent_account = parent.name if parent else None
|
parent_account = parent.name if parent else ""
|
||||||
children = [acc for acc in all_accounts if acc.parent_account == parent_account]
|
children = [acc for acc in all_accounts if cstr(acc.parent_account) == parent_account]
|
||||||
|
|
||||||
# if no children, but a group account
|
# if no children, but a group account
|
||||||
if not children and parent.is_group:
|
if not children and parent.is_group:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user