Remove starting wildcard when searching on codes and numbers

issue7347
review64541002
This commit is contained in:
Sergi Almacellas Abellana
2019-04-11 15:24:46 +02:00
parent 6f1a9b07b0
commit 50132daa0c
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -1,3 +1,4 @@
* Remove starting wildcard when searching on codes and numbers
* Allow product supplier to be defined on variants
Version 5.0.0 - 2018-10-01
+5 -1
View File
@@ -11,6 +11,7 @@ from trytond.model import ModelView, ModelSQL, MatchMixin, fields, \
from trytond.pyson import Eval, If, Bool
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
from trytond.tools import lstrip_wildcard
from trytond.modules.product import price_digits
@@ -293,11 +294,14 @@ class ProductSupplier(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