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
This commit is contained in:
@@ -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, (
|
||||
|
||||
Reference in New Issue
Block a user