From 6e02bfedcd00492cb124c36a26c5c6371277e981 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Thu, 5 Dec 2024 10:10:45 +0100 Subject: [PATCH] fix: add backward compatibility for 5 item filter (#28678) --- .github/workflows/_base-migration.yml | 2 +- frappe/types/filter.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_base-migration.yml b/.github/workflows/_base-migration.yml index defaabd7b4..e50cc24011 100644 --- a/.github/workflows/_base-migration.yml +++ b/.github/workflows/_base-migration.yml @@ -103,7 +103,7 @@ jobs: if pgrep honcho > /dev/null; then echo "Stopping honcho process..." pgrep honcho | xargs kill - sleep 3 + sleep 5 fi echo "Setting up environment..." diff --git a/frappe/types/filter.py b/frappe/types/filter.py index 6d6cf1b30b..03686a2bf5 100644 --- a/frappe/types/filter.py +++ b/frappe/types/filter.py @@ -97,6 +97,15 @@ class FilterTuple(_FilterTuple): fieldname, operator, value = s elif len(s) == 4: # type: ignore[redundant-expr] doctype, fieldname, operator, value = s + elif len(s) == 5: # type: ignore[unreachable] + from frappe.deprecation_dumpster import deprecation_warning + + deprecation_warning( + "2024-12-05", + "v16", + f"List type filters now should have 2, 3 or 4 elements: got 5 (Input: {s!r}). Hint: you probably need to remove the last filter element, a no-op from history.", + ) + doctype, fieldname, operator, value, _noop = s else: raise ValueError(f"Invalid sequence length: {len(s)}. Expected 2, 3, or 4 elements.") if is_unspecified(doctype) or doctype is None: