fix: query for filter by party
diff --git a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py
index d045d91..613d6f9 100644
--- a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py
+++ b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py
@@ -340,9 +340,6 @@
if filters.get("to_date"):
query = query.where(gle.posting_date <= filters.get("to_date"))
- if bank_accounts:
- query = query.where(gle.against.notin(bank_accounts))
-
if filters.get("party"):
party = [filters.get("party")]
jv_condition = gle.against.isin(party) | (
@@ -354,7 +351,14 @@
(gle.voucher_type == "Journal Entry")
& ((gle.party_type == filters.get("party_type")) | (gle.party_type == ""))
)
- query = query.where((gle.account.isin(tds_accounts) & jv_condition) | gle.party.isin(party))
+
+ query.where((gle.account.isin(tds_accounts) & jv_condition) | gle.party.isin(party))
+ if bank_accounts:
+ query = query.where(
+ gle.against.notin(bank_accounts) & (gle.account.isin(tds_accounts) & jv_condition)
+ | gle.party.isin(party)
+ )
+
return query