From 5c2ba0ef9c6e6424af95b841dade3e0b873184aa Mon Sep 17 00:00:00 2001 From: Joseph Marie Alba <54699674+erpjosephalba@users.noreply.github.com> Date: Thu, 28 Nov 2019 21:03:20 +0800 Subject: [PATCH] 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] --- .../chart_of_accounts_importer/chart_of_accounts_importer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 9bf5887b38f..34070b01aea 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 @@ def validate_account_types(accounts): 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: