From e0ec38c97d163a523451f5fd4ef3bc706b91d89b Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Thu, 11 Apr 2019 15:25:50 +0200 Subject: [PATCH] Remove starting wildcard when searching on codes and numbers issue7347 review64541002 --- product.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/product.py b/product.py index 413ebc1aae..c724fc594c 100644 --- a/product.py +++ b/product.py @@ -5,6 +5,7 @@ from trytond.model import (fields, ModelSQL, ModelView, sequence_ordered, MatchMixin) from trytond.pool import PoolMeta from trytond.pyson import If, Eval, Bool +from trytond.tools import lstrip_wildcard class ProductCustomer(sequence_ordered(), ModelSQL, ModelView, MatchMixin): @@ -55,11 +56,14 @@ class ProductCustomer(sequence_ordered(), ModelSQL, ModelView, MatchMixin): bool_op = 'AND' else: bool_op = 'OR' + code_value = clause[2] + if clause[1].endswith('like'): + code_value = lstrip_wildcard(clause[2]) domain = [bool_op, ('template',) + tuple(clause[1:]), ('product',) + tuple(clause[1:]), ('party',) + tuple(clause[1:]), - ('code',) + tuple(clause[1:]), + ('code', clause[1], code_value) + tuple(clause[3:]), ('name',) + tuple(clause[1:]), ] return domain