changeset 96aadf2b8e51 in modules/product:default
details: https://hg.tryton.org/modules/product?cmd=changeset;node=96aadf2b8e51
description:
Remove starting wildcard when searching on codes and numbers
issue7347
review64541002
diffstat:
CHANGELOG | 2 ++
product.py | 6 +++++-
2 files changed, 7 insertions(+), 1 deletions(-)
diffs (33 lines):
diff -r 39a412f85a05 -r 96aadf2b8e51 CHANGELOG
--- a/CHANGELOG Sun Apr 07 19:50:03 2019 +0200
+++ b/CHANGELOG Thu Apr 11 15:24:35 2019 +0200
@@ -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 -r 39a412f85a05 -r 96aadf2b8e51 product.py
--- a/product.py Sun Apr 07 19:50:03 2019 +0200
+++ b/product.py Thu Apr 11 15:24:35 2019 +0200
@@ -13,6 +13,7 @@
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 @@
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:]),
]