diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 16886cd939a4..cd0f7e90e04e 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -526,9 +526,16 @@ def get_accounting_entries( query = apply_additional_conditions(doctype, query, from_date, ignore_closing_entries, filters) query = query.where(gl_entry.account.isin(accounts)) - entries = query.run(as_dict=True) + from frappe.desk.reportview import build_match_conditions - return entries + match_conditions = build_match_conditions(doctype) + + if match_conditions: + query += "and" + match_conditions + + query, params = query.walk() + + return frappe.db.sql(query, params, as_dict=True) def apply_additional_conditions(doctype, query, from_date, ignore_closing_entries, filters):