Issue 4710

Title
Search on dict fields. FIX when is a str and new options to search in toolbar box
Priority
feature
Status
chatting
Nosy list
ced, resteve
Assigned to
Keywords
review

Created on 2015-04-22.09:53:31 by resteve, last changed 76 months ago by reviewbot.

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2015-04-22.10:13:24
Not a bug but a feature.
Author: [hidden] (resteve)
Date: 2015-04-22.09:53:29
When search in dict fields in toolbar search box client, example search toolbar box:

Attributes: "text1"

In this case, attribute is a string value and get this traceback:

Traceback (most recent call last):
  File "/trytond/protocols/jsonrpc.py", line 150, in _marshaled_dispatch
    response['result'] = dispatch_method(method, params)
  File "/trytond/protocols/jsonrpc.py", line 179, in _dispatch
    res = dispatch(*args)
  File "/trytond/protocols/dispatcher.py", line 161, in dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/model/modelsql.py", line 975, in search
    tables, expression = cls.search_domain(domain)
  File "/product.py", line 272, in search_domain
    active_test=active_test)
  File "/trytond/model/modelsql.py", line 1156, in search_domain
    expression = convert(domain)
  File "/trytond/model/modelsql.py", line 1154, in convert
    domain[1:] if domain[0] == 'AND' else domain)))
  File "/trytond/model/modelsql.py", line 1153, in <genexpr>
    return And((convert(d) for d in (
  File "/trytond/model/modelsql.py", line 1144, in convert
    expression = field.convert_domain(domain, tables, cls)
  File "/trytond/model/fields/field.py", line 259, in convert_domain
    expression = Operator(column, self._domain_value(operator, value))
  File "/trytond/model/fields/field.py", line 237, in _domain_value
    return self.sql_format(value)
  File "/trytond/model/fields/dict.py", line 40, in sql_format
    assert isinstance(value, dict)
AssertionError

An idea to search dict fields in toolbar is in case is string, create a dict. User could search in toolbar when write "key:value" separated by comm. Example:

Attributes: "text1:222"

or:

Attributes: "text1:222,text2:abc DF"
History
Date User Action Args
2015-04-22 17:30:26reviewbotsetreviews: 12121002
keyword: + review
2015-04-22 10:13:24cedsetpriority: bug -> feature
nosy: + ced
messages: + msg21096
2015-04-22 09:53:31restevecreate

Showing 10 items. Show all history (warning: this could be VERY long)