Tryton - Issues

 

Issue7876

Title Server crash when trying to create a sale from opportunity domain
Priority bug Status resolved
Superseder Nosy List ced, pokoli, reviewbot, roundup-bot
Type crash Components sao
Assigned To pokoli Keywords review
Reviews 60451002
View: 60451002

Created on 2018-11-21.19:56:53 by pokoli, last changed by roundup-bot.

Messages
New changeset 9718eefc8b61 by Sergi Almacellas Abellana in branch '5.0':
Set skip_target to localize_domain of reference fields
https://hg.tryton.org/sao/rev/9718eefc8b61

New changeset 40bcd290007a by Sergi Almacellas Abellana in branch '4.8':
Set skip_target to localize_domain of reference fields
https://hg.tryton.org/sao/rev/40bcd290007a

New changeset 00c8dfaf68ba by Sergi Almacellas Abellana in branch '4.6':
Set skip_target to localize_domain of reference fields
https://hg.tryton.org/sao/rev/00c8dfaf68ba

New changeset 6c8940d44be1 by Sergi Almacellas Abellana in branch '4.4':
Set skip_target to localize_domain of reference fields
https://hg.tryton.org/sao/rev/6c8940d44be1

New changeset ccfac7df9b76 by Sergi Almacellas Abellana in branch '4.2':
Set skip_target to localize_domain of reference fields
https://hg.tryton.org/sao/rev/ccfac7df9b76
New changeset 9058ceaa72aa by Sergi Almacellas Abellana in branch 'default':
Set skip_target to localize_domain of reference fields
https://hg.tryton.org/tryton-env/rev/9058ceaa72aa
New changeset ffc48276f97d by Sergi Almacellas Abellana in branch 'default':
Set skip_target to localize_domain of reference fields
https://hg.tryton.org/sao/rev/ffc48276f97d
review60451002 updated at https://codereview.tryton.org/60451002/#ps20001
msg45357 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-12-17.19:54:38
> But it is not what the review does nor explain in the title. So I'm confused.

I've updated the review to match the tryton code.
msg45039 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-11-26.22:18:19
But it is not what the review does nor explain in the title. So I'm confused.
msg45038 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-11-26.19:04:13
> I do not understand why in sao it requires to have a name and no on tryton?

localize_domain is defined as:

def localize_domain(domain, field_name=None, strip_target=False):

on true is called as:

localize_domain(domain, strip_target=True)

but on sao as

localize_domain(domain, true)

which should be:

localize_domain(domain, null, true) 

to be exactly the same equivalent as in tryton
msg45037 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-11-26.19:01:10
> Is not it related to issue7869?
At first look it does not look similar but I've tested issue7869 and it also fixes this case
msg45036 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-11-26.19:01:07
I do not understand why in sao it requires to have a name and no on tryton?
msg45035 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-11-26.18:51:12
> Why is not there the same fix for tryton?

Indeed tryton uses keyword arguments which allows to not set the name field as it's not used by the function code. 

I'm wondering if it will be better to use null on sao to keep the same behaviour or to set the value on both clients.
msg45010 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-11-25.16:23:44
Is not it related to issue7869?
msg45009 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-11-25.16:21:41
Why is not there the same fix for tryton?
review60451002 updated at https://codereview.tryton.org/60451002/#ps1
msg44971 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-11-22.09:29:43
Here is review60451002 that fixes it
msg44969 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-11-21.19:56:53
When following the next steps:

1. Create a sale opportunity
2. Use the relate action to open it's sales
3. Create a new sale from the new action
4. On the origin field, select "Sale Opportunity" model and use the magnifing glass to search for the opportunity. 

The following exceptions is raised:

Traceback (most recent call last):
  File "/usr/local/lib/python35/dist-packages/trytond/wsgipy", line 73, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/dispatcherpy", line 46, in rpc
    request, database_name, *requestrpc_params)
  File "/usr/local/lib/python35/dist-packages/trytond/wsgipy", line 44, in auth_required
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/wrapperspy", line 122, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/dispatcherpy", line 176, in _dispatch
    result = rpcresult(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python35/dist-packages/trytond/model/modelsqlpy", line 1172, in search
    tables, expression = clssearch_domain(domain)
  File "/usr/local/lib/python35/dist-packages/trytond/model/modelsqlpy", line 1356, in search_domain
    expression = convert(domain)
  File "/usr/local/lib/python35/dist-packages/trytond/model/modelsqlpy", line 1354, in convert
    domain[1:] if domain[0] == 'AND' else domain)))
  File "/usr/local/lib/python35/dist-packages/trytond/model/modelsqlpy", line 1353, in <genexpr>
    return And((convert(d) for d in (
  File "/usr/local/lib/python35/dist-packages/trytond/model/modelsqlpy", line 1344, in convert
    expression = fieldconvert_domain(domain, tables, cls)
  File "/usr/local/lib/python35/dist-packages/trytond/model/fields/fieldpy", line 348, in convert_domain
    name, operator, value = domain
ValueError: too many values to unpack (expected 3)

On tryton the same steps work without problem
History
Date User Action Args
2019-01-14 19:02:28roundup-botsetmessages: + msg45939
2019-01-03 12:00:40roundup-botsetmessages: + msg45807
2019-01-03 12:00:36roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg45806
2018-12-17 20:10:35reviewbotsetmessages: + msg45358
2018-12-17 19:54:39pokolisetmessages: + msg45357
2018-11-26 22:18:19cedsetmessages: + msg45039
2018-11-26 19:04:13pokolisetmessages: + msg45038
2018-11-26 19:01:11pokolisetmessages: + msg45037
2018-11-26 19:01:07cedsetmessages: + msg45036
2018-11-26 18:51:12pokolisetmessages: + msg45035

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