Issue 10334

Duplicated code in languages administration
Nosy list
ced, mrichez, pokoli, reviewbot, roundup-bot, tbruyere
Assigned to

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


New changeset 93991fa3efe9 by C├ędric Krier in branch 'default':
Make language code unique
New changeset c433e259ed6a by Maxime Richez in branch 'default':
Make language code unique
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/", line 116, in dispatch_request
return endpoint(request, request.view_args)
File "/trytond/protocols/", line 48, in rpc
request, database_name, request.rpc_params)
File "/trytond/", line 83, in auth_required
return wrapped(args, kwargs)
File "/trytond/protocols/", line 136, in wrapper
return func(request, pool, *args, *kwargs)
File "/trytond/protocols/", line 181, in _dispatch
result = rpc.result(meth(c_args, **c_kwargs))
File "/trytond/model/", line 868, in read
sub_ids, cls, field_list, values=sub_results)
File "/trytond/model/fields/", line 105, in get
return dict((name, call(name)) for name in names)
File "/trytond/model/fields/", line 105, in <genexpr>
return dict((name, call(name)) for name in names)
File "/trytond/model/fields/", line 100, in call
return dict((, method(r, name)) for r in records)
File "/trytond/model/fields/", line 100, in <genexpr>
return dict((, method(r, name)) for r in records)
File "/trytond/modules/purchase/", line 1692, in get_rec_name
lang = Lang.get()
File "/trytond/ir/", 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)

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)