From ba18ab2e16fe5ed09d3e063c497cb849903975bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 4 Sep 2026 08:30:25 +0200 Subject: [PATCH] Do not add searcher to the template function fields if the template field is not searchable Closes #15063 (grafted from c7ff87de982a3f9d0e46a62bfebe76751bcbf4e2) --HG-- branch : 8.0 --- modules/product/product.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/product/product.py b/modules/product/product.py index ad2a4733ea..fc2f158a7e 100644 --- a/modules/product/product.py +++ b/modules/product/product.py @@ -372,9 +372,10 @@ class Template( class TemplateFunction(fields.Function): - def __init__(self, field): + def __init__(self, field, searchable=True): super().__init__( - field, 'get_template', searcher='search_template') + field, 'get_template', + searcher='search_template' if searchable else None) # Disable on_change as it is managed by on_change_template self.on_change = set() self.on_change_with = set() @@ -619,7 +620,9 @@ class Product( tfield.states['invisible'] |= invisible_state else: tfield.states['invisible'] = invisible_state - setattr(cls, attr, TemplateFunction(tfield)) + searchable = tfield.searchable(Template) + setattr( + cls, attr, TemplateFunction(tfield, searchable=searchable)) order_method = getattr(cls, 'order_%s' % attr, None) if (not order_method and not isinstance(tfield, (