mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +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"):
|
if filters.get("to_date"):
|
||||||
query = query.where(gle.posting_date <= 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"):
|
if filters.get("party"):
|
||||||
party = [filters.get("party")]
|
party = [filters.get("party")]
|
||||||
jv_condition = gle.against.isin(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.voucher_type == "Journal Entry")
|
||||||
& ((gle.party_type == filters.get("party_type")) | (gle.party_type == ""))
|
& ((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
|
return query
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user