Fix patch issue9814

This commit is contained in:
Jared Esparza 2020-11-11 12:20:15 +01:00
parent 40e7b03116
commit 5dee6c90f8
2 changed files with 42 additions and 0 deletions

40
issue9814.diff Normal file
View File

@ -0,0 +1,40 @@
--- a/trytond/trytond/modules/product/product.py
+++ b/trytond/trytond/modules/product/product.py
@@ -165,9 +165,9 @@ class Template(
class TemplateFunction(fields.Function):
- def __init__(self, field):
+ def __init__(self, field, searcher):
super(TemplateFunction, self).__init__(
- field, 'get_template', searcher='search_template')
+ field, 'get_template', searcher=searcher)
# Disable on_change as it is managed by on_change_template
self.on_change = set()
self.on_change_with = set()
@@ -176,7 +176,7 @@ class TemplateFunction(fields.Function):
return TemplateFunction(copy.copy(self._field))
def __deepcopy__(self, memo):
- return TemplateFunction(copy.deepcopy(self._field, memo))
+ return TemplateFunction(copy.deepcopy(self._field, memo),self.searcher)
@staticmethod
def order(name):
@@ -246,7 +246,14 @@ class Product(
continue
field = getattr(cls, attr, None)
if not field or isinstance(field, TemplateFunction):
- setattr(cls, attr, TemplateFunction(copy.deepcopy(tfield)))
+ if (isinstance(tfield, fields.Function)
+ and not tfield.searcher
+ and not hasattr(Template, 'domain_' + attr)):
+ searcher = None
+ else:
+ searcher = 'search_template'
+ setattr(cls, attr, TemplateFunction(copy.deepcopy(tfield),
+ searcher))
order_method = getattr(cls, 'order_%s' % attr, None)
if (not order_method
and not isinstance(tfield, (

2
series
View File

@ -56,3 +56,5 @@ issue9797.diff # [account_payment_sepa] Slowness processing sepa
issue9802.diff # [stock] Improve performance when partially assigning moves
issue9519.diff # [sale + purchase] Use search context for product field on line
issue9814.diff #[product] Product template search bar showing non serchable product.product function fields as recomendation