diff --git a/CHANGELOG b/CHANGELOG index 31e9817077..c2924c4b06 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Make language code unique * Support base64 encoded data in ModelStorage.import_data * Add BOOL_AND and BOOL_OR to SQLite backend diff --git a/trytond/ir/lang.py b/trytond/ir/lang.py index eaeb6c5094..bbfc38cf8e 100644 --- a/trytond/ir/lang.py +++ b/trytond/ir/lang.py @@ -10,7 +10,8 @@ from sql import Table from trytond.cache import Cache from trytond.exceptions import UserError from trytond.i18n import gettext -from trytond.model import ModelView, ModelSQL, DeactivableMixin, fields, Check +from trytond.model import ( + ModelView, ModelSQL, DeactivableMixin, fields, Check, Unique) from trytond.modules import create_graph, load_translations from trytond.pool import Pool from trytond.pyson import Eval @@ -85,6 +86,8 @@ class Lang(DeactivableMixin, ModelSQL, ModelView): table = cls.__table__() cls._sql_constraints += [ + ('code_unique', Unique(table, table.code), + 'ir.msg_language_code_unique'), ('check_decimal_point_thousands_sep', Check(table, table.decimal_point != table.thousands_sep), 'decimal_point and thousands_sep must be different!'), diff --git a/trytond/ir/message.xml b/trytond/ir/message.xml index c02359acac..e24bf735b2 100644 --- a/trytond/ir/message.xml +++ b/trytond/ir/message.xml @@ -369,5 +369,8 @@ this repository contains the full copyright notices and license terms. --> Avatar URL + + The code on language must be unique. +