Duplicated code in languages administration
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)