details:   https://code.tryton.org/tryton/commit/db39257b65ab
branch:    7.0
user:      Cédric Krier <[email protected]>
date:      Fri Sep 04 08:30:25 2026 +0200
description:
        Do not add searcher to the template function fields if the template 
field is not searchable

        Closes #15063
        (grafted from c7ff87de982a3f9d0e46a62bfebe76751bcbf4e2)
diffstat:

 modules/product/product.py |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 84d09dd9582b -r db39257b65ab modules/product/product.py
--- a/modules/product/product.py        Fri Sep 04 11:53:57 2026 +0200
+++ b/modules/product/product.py        Fri Sep 04 08:30:25 2026 +0200
@@ -352,9 +352,10 @@
 
 class TemplateFunction(fields.Function):
 
-    def __init__(self, field):
-        super(TemplateFunction, self).__init__(
-            field, 'get_template', searcher='search_template')
+    def __init__(self, field, searchable=True):
+        super().__init__(
+            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()
@@ -478,7 +479,9 @@
                     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, (

Reply via email to