Fix: Logic bug (#19692)
account_groups = [accounts[d]["account_type"] for d in accounts if accounts[d]['is_group'] not in ('', 1)]
- if accounts[d]['is_group'] not in ('', 1) is wrong because it returns false even if the account is a group.
- should be if accounts[d]['is_group'] not in ('', 0)
However, the correction provided here:
account_groups = [accounts[d]["account_type"] for d in accounts if accounts[d]['is_group'] == 1]
is more consistent with the prior statement that extracts ledger (and not group) accounts.
account_types = [accounts[d]["account_type"] for d in accounts if not accounts[d]['is_group'] == 1]
diff --git a/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py b/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
index 9bf5887..34070b0 100644
--- a/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
+++ b/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
@@ -185,7 +185,8 @@
return _("Please identify/create Account (Ledger) for type - {0}").format(' , '.join(missing))
account_types_for_group = ["Bank", "Cash", "Stock"]
- account_groups = [accounts[d]["account_type"] for d in accounts if accounts[d]['is_group'] not in ('', 1)]
+ # fix logic bug
+ account_groups = [accounts[d]["account_type"] for d in accounts if accounts[d]['is_group'] == 1]
missing = list(set(account_types_for_group) - set(account_groups))
if missing: