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

        issue7347
        review64541002
diffstat:

 product.py |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r 2bb52865b7ca -r 3fa0193e1acf product.py
--- a/product.py        Sun Apr 07 19:50:04 2019 +0200
+++ b/product.py        Thu Apr 11 15:25:50 2019 +0200
@@ -5,6 +5,7 @@
     MatchMixin)
 from trytond.pool import PoolMeta
 from trytond.pyson import If, Eval, Bool
+from trytond.tools import lstrip_wildcard
 
 
 class ProductCustomer(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
@@ -55,11 +56,14 @@
             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

Reply via email to