@@ -15,5 +15,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.message" id="msg_inspection_delete_non_pending">
|
||||
<field name="text">To delete inspection "%(inspection)s" you must reset its state to pending.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_control_point_unique">
|
||||
<field name="text">The names of control points must be unique.</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
||||
@@ -10,7 +10,7 @@ from sql.functions import CharLength
|
||||
from trytond.i18n import gettext, lazy_gettext
|
||||
from trytond.model import (
|
||||
DeactivableMixin, DictSchemaMixin, MatchMixin, ModelSingleton, ModelSQL,
|
||||
ModelStorage, ModelView, Workflow, dualmethod, fields)
|
||||
ModelStorage, ModelView, Unique, Workflow, dualmethod, fields)
|
||||
from trytond.model.exceptions import AccessError, ButtonActionException
|
||||
from trytond.modules.company.model import (
|
||||
CompanyMultiValueMixin, CompanyValueMixin, employee_field, reset_employee,
|
||||
@@ -312,6 +312,11 @@ class ControlPoint(DictSchemaMixin, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
t = cls.__table__()
|
||||
cls._sql_constraints = [
|
||||
('control_point_unique', Unique(t, t.control, t.name),
|
||||
'quality.msg_control_point_unique'),
|
||||
]
|
||||
cls.__access__.add('control')
|
||||
cls.type_.selection = [
|
||||
('boolean', lazy_gettext('ir.msg_dict_schema_boolean')),
|
||||
|
||||
Reference in New Issue
Block a user