Remove starting wildcard when searching on codes and numbers

issue7347
review64541002
This commit is contained in:
Sergi Almacellas Abellana committed 2019-04-11 15:23:59 +02:00
1 parent caa01fbf10
commit 379ba5d088
2 files changed
+7 -2

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Remove starting wildcard when searching on codes and numbers
* Include all identifier from python-stdnum
* Use country code as local prefix to parse phone numbers
+6 -2
View File
@@ -14,6 +14,7 @@ from trytond.transaction import Transaction
from trytond.pool import Pool
from trytond import backend
from trytond.tools.multivalue import migrate_property
from trytond.tools import lstrip_wildcard
from .exceptions import (
InvalidIdentifierCode, VIESUnavailable, SimilarityWarning, EraseError)
@@ -220,9 +221,12 @@ class Party(DeactivableMixin, ModelSQL, ModelView, MultiValueMixin):
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:]),
('identifiers.code',) + tuple(clause[1:]),
('code', clause[1], code_value) + tuple(clause[3:]),
('identifiers.code', clause[1], code_value) + tuple(clause[3:]),
('name',) + tuple(clause[1:]),
('contact_mechanisms.rec_name',) + tuple(clause[1:]),
]