mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-16 16:08:39 +00:00
fix: accept a scalar account filter in Invalid Ledger Entries report
This commit is contained in:
@@ -84,7 +84,8 @@ def build_query_filters(filters: dict | None = None) -> list:
|
||||
qb_filters = []
|
||||
if filters:
|
||||
if filters.account:
|
||||
qb_filters.append(qb.Field("account").isin(filters.account))
|
||||
accounts = filters.account if isinstance(filters.account, list | tuple) else [filters.account]
|
||||
qb_filters.append(qb.Field("account").isin(accounts))
|
||||
|
||||
if filters.voucher_no:
|
||||
qb_filters.append(qb.Field("voucher_no").eq(filters.voucher_no))
|
||||
|
||||
@@ -109,6 +109,14 @@ class TestInvalidLedgerEntries(ERPNextTestSuite):
|
||||
flagged = {row.get("voucher_no") for row in self.run_report(account=[unrelated])}
|
||||
self.assertNotIn(orphan.name, flagged)
|
||||
|
||||
def test_account_filter_accepts_a_scalar(self):
|
||||
"""A scalar (non-list) account filter must not crash the query."""
|
||||
orphan = self.make_submitted_jv()
|
||||
frappe.db.set_value("Journal Entry", orphan.name, "docstatus", 2, update_modified=False)
|
||||
|
||||
flagged = {row.get("voucher_no") for row in self.run_report(account=self.debit_account)}
|
||||
self.assertIn(orphan.name, flagged)
|
||||
|
||||
def test_period_filter_excludes_out_of_range(self):
|
||||
"""Vouchers posted outside the from/to window must not be scanned."""
|
||||
orphan = self.make_submitted_jv()
|
||||
|
||||
Reference in New Issue
Block a user