Issue 9354

Title
Crash when searching multiple work names
Priority
bug
Status
resolved
Nosy list
ced, pokoli, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2020-05-20.12:13:57 by pokoli, last changed 2 months ago by roundup-bot.

Messages

New changeset a86dba790821 by Cédric Krier in branch '5.6':
Construct recursively Tree search_rec_name with 'in' operators
https://hg.tryton.org/trytond/rev/a86dba790821

New changeset 5d1e3b139ef2 by Cédric Krier in branch '5.4':
Construct recursively Tree search_rec_name with 'in' operators
https://hg.tryton.org/trytond/rev/5d1e3b139ef2

New changeset e6f346b31218 by Cédric Krier in branch '5.0':
Construct recursively Tree search_rec_name with 'in' operators
https://hg.tryton.org/trytond/rev/e6f346b31218
New changeset e3c998522003 by Cédric Krier in branch 'default':
Construct recursively Tree search_rec_name with 'in' operators
https://hg.tryton.org/tryton-env/rev/e3c998522003
New changeset 84244f5b7641 by Cédric Krier in branch 'default':
Construct recursively Tree search_rec_name with 'in' operators
https://hg.tryton.org/trytond/rev/84244f5b7641
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-10-24.16:08:23

The problem is in the search_rec_name of the TreeMixin with the in operators.

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2020-05-20.12:13:56
If I use the following filter on timesheet lines: "Work: analyis;design"

I get the following exception:

Warning:

Traceback (most recent call last):
  File "/usr/local/lib/python37/dist-packages/trytond/wsgipy", line 109, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python37/dist-packages/trytond/protocols/dispatcherpy", line 48, in rpc
    request, database_name, *requestrpc_params)
  File "/usr/local/lib/python37/dist-packages/trytond/wsgipy", line 77, in auth_required
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python37/dist-packages/trytond/protocols/wrapperspy", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/usr/local/lib/python37/dist-packages/trytond/protocols/dispatcherpy", line 181, in _dispatch
    result = rpcresult(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1248, in search
    tables, expression = clssearch_domain(domain)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1435, in search_domain
    expression = convert(domain)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1433, in convert
    domain[1:] if domain[0] == 'AND' else domain)))
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1432, in <genexpr>
    return And((convert(d) for d in (
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1423, in convert
    expression = fieldconvert_domain(domain, tables, cls)
  File "/usr/local/lib/python37/dist-packages/trytond/model/fields/fieldpy", line 192, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python37/dist-packages/trytond/model/fields/many2onepy", line 238, in convert_domain
    target_domain, tables=target_tables)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1435, in search_domain
    expression = convert(domain)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1433, in convert
    domain[1:] if domain[0] == 'AND' else domain)))
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1432, in <genexpr>
    return And((convert(d) for d in (
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1425, in convert
    return convert(expression)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1430, in convert
    return Or((convert(d) for d in domain[1:]))
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1430, in <genexpr>
    return Or((convert(d) for d in domain[1:]))
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1423, in convert
    expression = fieldconvert_domain(domain, tables, cls)
  File "/usr/local/lib/python37/dist-packages/trytond/model/fields/fieldpy", line 192, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python37/dist-packages/trytond/model/fields/referencepy", line 183, in convert_domain
    query = Targetsearch(target_domain, order=[], query=True)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1248, in search
    tables, expression = clssearch_domain(domain)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1435, in search_domain
    expression = convert(domain)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1433, in convert
    domain[1:] if domain[0] == 'AND' else domain)))
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1432, in <genexpr>
    return And((convert(d) for d in (
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1423, in convert
    expression = fieldconvert_domain(domain, tables, cls)
  File "/usr/local/lib/python37/dist-packages/trytond/model/fields/functionpy", line 79, in convert_domain
    return getattr(Model, selfsearcher)(selfname, domain)
  File "/usr/local/lib/python37/dist-packages/trytond/model/treepy", line 49, in search_rec_name
    for i, v in range(reversed(valuesplit(separator))):
TypeError: 'list_reverseiterator' object cannot be interpreted as an integer

The client performs the following searc on the server:

search(*(['work.rec_name', 'in', ['analyis', 'design']]

This can be reproducible on latest demo.
History
Date User Action Args
2020-10-30 20:04:32roundup-botsetkeyword: - backport
messages: + msg61577
2020-10-26 21:27:46roundup-botsetmessages: + msg61427
2020-10-26 21:27:43roundup-botsetmessages: + msg61426
nosy: + roundup-bot
status: testing -> resolved
2020-10-26 21:27:28cedsetkeyword: + backport
2020-10-24 16:31:30reviewbotsetmessages: + msg61361
nosy: + reviewbot
2020-10-24 16:12:54cedsetkeyword: + review
reviews: 304601002
status: in-progress -> testing
2020-10-24 16:08:23cedsetassignedto: ced
component: + trytond
messages: + msg61360
nosy: + ced
status: unread -> in-progress
2020-05-20 12:13:57pokolicreate