mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-27 02:28:30 +00:00
fix: query for filter by party
This commit is contained in:
@@ -340,9 +340,6 @@ def get_tds_docs_query(filters, bank_accounts, tds_accounts):
|
||||
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 @@ def get_tds_docs_query(filters, bank_accounts, tds_accounts):
|
||||
(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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user