fix: fetch party types based on account type in journal entry and refactor SQL to query builder

(cherry picked from commit 6f225920d0)
This commit is contained in:
S Sakthivel Murugan
2026-06-19 13:05:35 +05:30
committed by Mergify
parent e6e5591088
commit bbb3181c6e

View File

@@ -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)