From 6f225920d0869ac60fd12db2a2fc2bd195143205 Mon Sep 17 00:00:00 2001 From: S Sakthivel Murugan Date: Fri, 19 Jun 2026 13:05:35 +0530 Subject: [PATCH] fix: fetch party types based on account type in journal entry and refactor SQL to query builder --- erpnext/setup/doctype/party_type/party_type.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/erpnext/setup/doctype/party_type/party_type.py b/erpnext/setup/doctype/party_type/party_type.py index cf72eb3bbdc..d0b2422405a 100644 --- a/erpnext/setup/doctype/party_type/party_type.py +++ b/erpnext/setup/doctype/party_type/party_type.py @@ -33,14 +33,11 @@ def get_party_type(doctype: str, txt: str, searchfield: str, start: int, page_le if filters and filters.get("account"): account_type = frappe.db.get_value("Account", filters.get("account"), "account_type") - if account_type: - if account_type in ["Receivable", "Payable"]: - # Include Employee regardless of its configured account_type, but still respect the text filter - condition_list.append( - (PartyType.account_type == account_type) | (PartyType.name == "Employee") - ) - else: - condition_list.append(PartyType.account_type == account_type) + if account_type in ["Receivable", "Payable"]: + # Include Employee regardless of its configured account_type, but still respect the text filter + condition_list.append((PartyType.account_type == account_type) | (PartyType.name == "Employee")) + else: + condition_list.append(PartyType.account_type == account_type) for condition in condition_list: get_party_type_query = get_party_type_query.where(condition)