changeset 840f9be244ae in modules/bank:default
details: https://hg.tryton.org/modules/bank?cmd=changeset;node=840f9be244ae
description:
        Remove starting wildcard when searching on codes and numbers

        issue7347
        review64541002
diffstat:

 CHANGELOG |  2 ++
 party.py  |  6 +++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r c38a3dd2b292 -r 840f9be244ae CHANGELOG
--- a/CHANGELOG Sun Apr 07 19:50:02 2019 +0200
+++ b/CHANGELOG Thu Apr 11 15:20:51 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 c38a3dd2b292 -r 840f9be244ae party.py
--- a/party.py  Sun Apr 07 19:50:02 2019 +0200
+++ b/party.py  Thu Apr 11 15:20:51 2019 +0200
@@ -2,6 +2,7 @@
 # this repository contains the full copyright notices and license terms.
 from trytond.pool import PoolMeta
 from trytond.model import fields
+from trytond.tools import lstrip_wildcard
 
 
 __all__ = ['Party', 'PartyReplace']
@@ -19,9 +20,12 @@
             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,
             domain,
-            ('bank_accounts',) + tuple(clause[1:]),
+            ('bank_accounts', clause[1], code_value) + tuple(clause[3:]),
             ]
 
 

Reply via email to