Issue 10334

Title
Duplicated code in languages administration
Priority
bug
Status
resolved
Nosy list
ced, mrichez, pokoli, reviewbot, roundup-bot, tbruyere
Assigned to
mrichez
Keywords
review

Created on 2021-04-23.10:37:15 by tbruyere, last changed 1 month ago by roundup-bot.

Messages

New changeset 93991fa3efe9 by C├ędric Krier in branch 'default':
Make language code unique
https://hg.tryton.org/tryton-env/rev/93991fa3efe9
New changeset c433e259ed6a by Maxime Richez in branch 'default':
Make language code unique
https://hg.tryton.org/trytond/rev/c433e259ed6a
Author: [hidden] (mrichez)
Date: 2021-05-02.19:49:49

Should solve the problem.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-05-02.09:55:55

I guess we should add a unique constraint on the language code.

Author: [hidden] (tbruyere)
Date: 2021-04-23.10:37:15

It is possible to create a new language in Administration / Localization / Languages.
If use a language code already present, there is no duplication control.

Tested with code : en

An error is generated during save, but it is still possible to use this new language for a user.

ERROR:tryton.common.common:Traceback (most recent call last):
File "/trytond/wsgi.py", line 116, in dispatch_request
return endpoint(request, request.view_args)
File "/trytond/protocols/dispatcher.py", line 48, in rpc
request, database_name, request.rpc_params)
File "/trytond/wsgi.py", line 83, in auth_required
return wrapped(args, kwargs)
File "/trytond/protocols/wrappers.py", line 136, in wrapper
return func(request, pool, *args, *kwargs)
File "/trytond/protocols/dispatcher.py", line 181, in _dispatch
result = rpc.result(meth(c_args, **c_kwargs))
File "/trytond/model/modelsql.py", line 868, in read
sub_ids, cls, field_list, values=sub_results)
File "/trytond/model/fields/function.py", line 105, in get
return dict((name, call(name)) for name in names)
File "/trytond/model/fields/function.py", line 105, in <genexpr>
return dict((name, call(name)) for name in names)
File "/trytond/model/fields/function.py", line 100, in call
return dict((r.id, method(r, name)) for r in records)
File "/trytond/model/fields/function.py", line 100, in <genexpr>
return dict((r.id, method(r, name)) for r in records)
File "/trytond/modules/purchase/purchase.py", line 1692, in get_rec_name
lang = Lang.get()
File "/trytond/ir/lang.py", line 362, in get
('code', '=', code),
ValueError: too many values to unpack (expected 1)

Fault: too many values to unpack (expected 1)

If a user chooses this language in this preferences, the GTK client crashes (no longer responds)

History
Date User Action Args
2021-05-18 22:35:05roundup-botsetmessages: + msg67670
2021-05-18 22:34:59roundup-botsetmessages: + msg67669
nosy: + roundup-bot
status: testing -> resolved
2021-05-17 11:56:19reviewbotsetmessages: + msg67624
2021-05-17 11:33:29reviewbotsetmessages: + msg67623
2021-05-03 22:15:05reviewbotsetmessages: + msg67348
2021-05-02 21:18:20reviewbotsetmessages: + msg67329
nosy: + reviewbot
2021-05-02 21:07:57mrichezsetkeyword: + review
reviews: 334301004
status: in-progress -> testing
2021-05-02 21:03:02mrichezsetassignedto: mrichez
2021-05-02 21:02:47mrichezsetstatus: chatting -> in-progress
2021-05-02 19:49:49mrichezsetmessages: + msg67328

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