Files
erpnext/erpnext
Fawaz Alhafiz d950de2d09 fix: SQL operator precedence in Project query customer filter
Added explicit parentheses around customer OR conditions in get_project_name()
to ensure proper grouping with AND filters. Without these parentheses, SQL
operator precedence caused the status filter to be bypassed when a customer
filter was applied, resulting in completed and cancelled projects appearing
in link field dropdowns.

Before:
WHERE customer='X' OR customer IS NULL OR customer='' AND status NOT IN (...)
was interpreted as:
WHERE customer='X' OR customer IS NULL OR (customer='' AND status NOT IN (...))

After:
WHERE (customer='X' OR customer IS NULL OR customer='') AND status NOT IN (...)

Fixes: Completed/cancelled projects showing in Project link fields
Affected: Any doctype using Project link fields with customer filters
(cherry picked from commit 0ec30a1cea)
2025-10-06 07:34:55 +00:00
..
2022-03-28 18:52:46 +05:30
2022-04-28 12:02:54 +05:30
2025-10-03 10:02:09 +00:00
2025-09-29 16:20:27 +00:00
2025-09-23 09:22:03 +00:00
2022-03-28 18:52:46 +05:30
2025-09-01 09:13:04 +00:00