lims_industry: component: add the customer description to the unique constraint

This commit is contained in:
Adrián Bernardi 2020-12-23 16:10:43 -03:00
parent bb42b1de79
commit db1fed9855
3 changed files with 12 additions and 7 deletions

View File

@ -370,8 +370,9 @@ class Component(ModelSQL, ModelView):
cls._order.insert(1, ('type', 'ASC'))
t = cls.__table__()
cls._sql_constraints = [
('type_unique', Unique(t, t.equipment, t.type),
'lims_industry.msg_component_type_unique'),
('type_description_unique', Unique(t, t.equipment, t.type,
t.customer_description),
'lims_industry.msg_component_unique'),
]
@classmethod

View File

@ -789,9 +789,13 @@ msgctxt "model:ir.message,text:msg_component_type_name_unique"
msgid "There is already a component type with the same name"
msgstr "Ya existe un tipo de componente con el mismo nombre"
msgctxt "model:ir.message,text:msg_component_type_unique"
msgid "A component of the same type already exists for the equipment"
msgstr "Ya existe un componente del mismo tipo para el equipo"
msgctxt "model:ir.message,text:msg_component_unique"
msgid ""
"A component of the same type and description already exists for the "
"equipment"
msgstr ""
"Ya existe para el equipo un componente del mismo tipo con la misma "
"descripción"
msgctxt "model:ir.message,text:msg_edit_entry_party"
msgid "You must select all samples from the same entry to change the Party"

View File

@ -19,8 +19,8 @@
<record model="ir.message" id="lbl_sample_missing_data">
<field name="text">Missing data in Sample</field>
</record>
<record model="ir.message" id="msg_component_type_unique">
<field name="text">A component of the same type already exists for the equipment</field>
<record model="ir.message" id="msg_component_unique">
<field name="text">A component of the same type and description already exists for the equipment</field>
</record>
<record model="ir.message" id="msg_equipment_name_unique">
<field name="text">There is already an equipment with the same name for the plant</field>