mirror of
https://github.com/frappe/erpnext.git
synced 2026-07-01 06:48:36 +00:00
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:
committed by
Mergify
parent
e6e5591088
commit
bbb3181c6e
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user