Make language code unique

issue10334
review334301004
This commit is contained in:
Maxime Richez
2021-05-18 22:34:43 +02:00
parent 056d15ede5
commit dca4d207f8
3 changed files with 8 additions and 1 deletions
+1
View File
@@ -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
+4 -1
View File
@@ -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!'),
+3
View File
@@ -369,5 +369,8 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.message" id="msg_avatar_url">
<field name="text">Avatar URL</field>
</record>
<record model="ir.message" id="msg_language_code_unique">
<field name="text">The code on language must be unique.</field>
</record>
</data>
</tryton>