From 5a032f319151743a8217da3fe51bf244a0dc536f Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Thu, 11 Apr 2019 15:24:35 +0200 Subject: [PATCH] Remove starting wildcard when searching on codes and numbers issue7347 review64541002 --- CHANGELOG | 2 ++ product.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index dbbca2acd3..f538640e9c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Remove starting wildcard when searching on codes and numbers + Version 5.0.0 - 2018-10-01 * Bug fixes (see mercurial logs for details) * Remove support for Python 2.7 diff --git a/product.py b/product.py index c367cb2263..7bef912276 100644 --- a/product.py +++ b/product.py @@ -13,6 +13,7 @@ from trytond.transaction import Transaction from trytond.pool import Pool from trytond import backend from trytond.config import config +from trytond.tools import lstrip_wildcard from trytond.tools.multivalue import migrate_property from trytond.modules.company.model import ( CompanyMultiValueMixin, CompanyValueMixin) @@ -309,8 +310,11 @@ class Product( bool_op = 'AND' else: bool_op = 'OR' + code_value = clause[2] + if clause[1].endswith('like'): + code_value = lstrip_wildcard(clause[2]) return [bool_op, - ('code',) + tuple(clause[1:]), + ('code', clause[1], code_value) + tuple(clause[3:]), ('template.name',) + tuple(clause[1:]), ]