Tryton - Issues

 

Issue7947

Title problem with attributes on product variants
Priority bug Status chatting
Superseder Nosy List lordvan, pokoli, risto3
Type crash Components product_attribute
Assigned To Keywords
Reviews

Created on 2018-12-27.12:51:53 by risto3, last changed by risto3.

Messages
msg45607 (view) Author: [hidden] (risto3) Date: 2018-12-29.16:11:43
? 
Selection list implies something more like a fixed enumerated [list] as opposed to a char, int, or other non constrained value for the attribute.

For example, if I have coef, the values list here is {150,170,185,210,230,250,270}

When applying the attribute, if there where an optional description, like typically done in many software, then it could be shown in order to help the selection process.

This would allow a search, for example, on product with attribute coef:210

If I add this attribute, I must select one of these defined values.

Also, another bug, it appears that one can add the attribute with an empty value, even if an empty value is not in the list! This should not be possible.
msg45521 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-12-29.13:00:08
I think we should extend the DictSchemaMixin to validate [1] the correct format of the selection values to ensure no incorrect values are defined. 

A patch for it will welcome

[1] http://hg.tryton.org/trytond/file/c1c878ddacb2/trytond/model/dictschema.py#l64
msg45520 (view) Author: [hidden] (lordvan) Date: 2018-12-29.12:02:15
I had the same problem just now.
I only had forgotten that the attribute list was in the format "key:value"

here is an example:
MAIN:Main course
STARTER:Starters

It would be nice to have some way to verify the input on the Attribute itself. maybe make an action for it?
msg45506 (view) Author: [hidden] (risto3) Date: 2018-12-27.12:51:52
With either gtk or js client I have problems with variants using attributes.
I create a a product set 'MO attributes' with two attributes, 'coef' and 'zone', each a selection list of fixed values.

Then I create a product [template] "Main d'oeuvre" with the above attribute set selected.

Then I try to create a product variant, e.g. OE1 with just one attribute 'coef', wanting to select '150'.

But trying to select, for example, the attribute 'coef' I get :

Traceback (most recent call last):
  File "/opt/trytond/trytond/protocols/dispatcher.py", line 176, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/opt/trytond/trytond/model/dictschema.py", line 107, in get_keys
    english_key.selection_json))
ValueError: need more than 1 value to unpack
24143 140188462343936 [2018-12-27 11:45:26,282] INFO werkzeug 127.0.0.1 - - [27/Dec/2018 11:45:26] "POST /tBAOU2/ HTTP/1.1" 200 -
ERROR:tryton.common.common:Traceback (most recent call last):
  File "/trytond/wsgi.py", line 73, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 46, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/wsgi.py", line 44, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 122, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 176, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/model/dictschema.py", line 107, in get_keys
    english_key.selection_json))
ValueError: need more than 1 value to unpack

need more than 1 value to unpack



Perhaps related to Issue4549?
History
Date User Action Args
2018-12-29 16:11:44risto3setmessages: + msg45607
2018-12-29 13:00:09pokolisetnosy: + pokoli
messages: + msg45521
2018-12-29 12:02:16lordvansetstatus: unread -> chatting
nosy: + lordvan
messages: + msg45520
2018-12-27 12:51:53risto3create

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