changeset 38b1f1273247 in modules/account:default details: https://hg.tryton.org/modules/account?cmd=changeset;node=38b1f1273247 description: Remove starting wildcard when searching on codes and numbers
issue7347 review64541002 diffstat: CHANGELOG | 1 + account.py | 7 +++++-- journal.py | 7 +++++-- tax.py | 7 +++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diffs (83 lines): diff -r d5e2bdf73e16 -r 38b1f1273247 CHANGELOG --- a/CHANGELOG Sun Apr 07 19:50:02 2019 +0200 +++ b/CHANGELOG Thu Apr 11 15:20:02 2019 +0200 @@ -1,3 +1,4 @@ +* Remove starting wildcard when searching on codes and numbers * Remove display balance * Merge account kind and account type * Add origin on move line diff -r d5e2bdf73e16 -r 38b1f1273247 account.py --- a/account.py Sun Apr 07 19:50:02 2019 +0200 +++ b/account.py Thu Apr 11 15:20:02 2019 +0200 @@ -17,7 +17,7 @@ from trytond.wizard import Wizard, StateView, StateAction, StateTransition, \ Button from trytond.report import Report -from trytond.tools import reduce_ids, grouped_slice +from trytond.tools import reduce_ids, grouped_slice, lstrip_wildcard from trytond.pyson import Eval, If, PYSONEncoder, Bool from trytond.transaction import Transaction from trytond.pool import Pool @@ -1019,8 +1019,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:]), (cls._rec_name,) + tuple(clause[1:]), ] diff -r d5e2bdf73e16 -r 38b1f1273247 journal.py --- a/journal.py Sun Apr 07 19:50:02 2019 +0200 +++ b/journal.py Thu Apr 11 15:20:02 2019 +0200 @@ -12,7 +12,7 @@ from trytond.pyson import Eval, Bool from trytond.transaction import Transaction from trytond.pool import Pool -from trytond.tools import reduce_ids, grouped_slice +from trytond.tools import reduce_ids, grouped_slice, lstrip_wildcard from trytond.tools.multivalue import migrate_property from trytond.modules.company.model import ( CompanyMultiValueMixin, CompanyValueMixin) @@ -80,8 +80,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:]), (cls._rec_name,) + tuple(clause[1:]), ] diff -r d5e2bdf73e16 -r 38b1f1273247 tax.py --- a/tax.py Sun Apr 07 19:50:02 2019 +0200 +++ b/tax.py Thu Apr 11 15:20:02 2019 +0200 @@ -18,7 +18,7 @@ from trytond import backend from trytond.pyson import Eval, If, Bool, PYSONEncoder from trytond.transaction import Transaction -from trytond.tools import cursor_dict +from trytond.tools import cursor_dict, lstrip_wildcard from trytond.pool import Pool from .common import PeriodMixin, ActivePeriodMixin @@ -227,8 +227,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:]), (cls._rec_name,) + tuple(clause[1:]), ]