From 38e8c3b1fedd318aafdf976726c4b5fd068dec07 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sun, 12 Jul 2026 18:37:51 +0530 Subject: [PATCH] fix: accounting dimension search matching unrelated records MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #56871 routed any searchfield without a DocField meta — including "name", which get_search_fields() always appends — into the `= cint(txt)` branch. For non-numeric search text cint() yields 0, so `is_group = 0` (Cost Center) matched every leaf record on both engines, and `name = 0` matched every non-numeric name on MariaDB. Skip Check fields from or_filters entirely — a checkbox can't match search text — and keep LIKE for everything else, including "name". --- erpnext/controllers/queries.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index dd587ef2f22..8301392d144 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -20,7 +20,7 @@ from frappe.query_builder.functions import ( Substring, Sum, ) -from frappe.utils import cint, nowdate, today, unique +from frappe.utils import nowdate, today, unique from pypika import Order import erpnext @@ -809,10 +809,8 @@ def get_filtered_dimensions( for field in searchfields: df = meta.get_field(field) - if df and df.fieldtype != "Check": + if not df or df.fieldtype != "Check": or_filters.append([field, "LIKE", "%%%s%%" % txt]) - else: - or_filters.append([field, "=", cint(txt)]) fields.append(field) if dimension_filters: