From 4a37f2a925f4bfc15a4450b51dedac64a34233e8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 2 May 2025 15:45:46 +0530 Subject: [PATCH] fix: broken test suite due to incorrect OR filter (cherry picked from commit 37d74e387d68c64be36b381aa3267b3459e2b358) --- erpnext/setup/setup_wizard/operations/taxes_setup.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/erpnext/setup/setup_wizard/operations/taxes_setup.py b/erpnext/setup/setup_wizard/operations/taxes_setup.py index f8cd61d50ea..3cc405aa658 100644 --- a/erpnext/setup/setup_wizard/operations/taxes_setup.py +++ b/erpnext/setup/setup_wizard/operations/taxes_setup.py @@ -214,13 +214,12 @@ def get_or_create_account(company_name, account): default_root_type = "Liability" root_type = account.get("root_type", default_root_type) + or_filters = {"account_name": account.get("account_name")} + if account.get("account_number"): + or_filters.update({"account_number": account.get("account_number")}) + existing_accounts = frappe.get_all( - "Account", - filters={"company": company_name, "root_type": root_type}, - or_filters={ - "account_name": account.get("account_name"), - "account_number": account.get("account_number"), - }, + "Account", filters={"company": company_name, "root_type": root_type}, or_filters=or_filters ) if existing_accounts: