mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims_industry: add component kind and location
This commit is contained in:
parent
196531f2cb
commit
7c62a3c2a9
|
@ -19,6 +19,8 @@ def register():
|
|||
industry.Plant,
|
||||
industry.EquipmentType,
|
||||
industry.Brand,
|
||||
industry.ComponentKind,
|
||||
industry.ComponentLocation,
|
||||
industry.ComponentType,
|
||||
industry.EquipmentTemplate,
|
||||
industry.EquipmentTemplateComponentType,
|
||||
|
|
|
@ -140,6 +140,44 @@ class Brand(ModelSQL, ModelView):
|
|||
return new_records
|
||||
|
||||
|
||||
class ComponentKind(ModelSQL, ModelView):
|
||||
'Component Kind'
|
||||
__name__ = 'lims.component.kind'
|
||||
|
||||
name = fields.Char('Name', required=True)
|
||||
product_type = fields.Many2One('lims.product.type', 'Product type',
|
||||
required=True)
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
t = cls.__table__()
|
||||
cls._sql_constraints = [
|
||||
('name_unique', Unique(t, t.name),
|
||||
'lims_industry.msg_component_kind_name_unique'),
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def copy(cls, records, default=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
current_default = default.copy()
|
||||
|
||||
new_records = []
|
||||
for record in records:
|
||||
current_default['name'] = '%s (copy)' % record.name
|
||||
new_record, = super().copy([record], default=current_default)
|
||||
new_records.append(new_record)
|
||||
return new_records
|
||||
|
||||
|
||||
class ComponentLocation(ModelSQL, ModelView):
|
||||
'Component Location'
|
||||
__name__ = 'lims.component.location'
|
||||
|
||||
name = fields.Char('Name', required=True)
|
||||
|
||||
|
||||
class ComponentType(ModelSQL, ModelView):
|
||||
'Component Type'
|
||||
__name__ = 'lims.component.type'
|
||||
|
@ -147,6 +185,8 @@ class ComponentType(ModelSQL, ModelView):
|
|||
name = fields.Char('Name', required=True)
|
||||
product_type = fields.Many2One('lims.product.type', 'Product type',
|
||||
required=True)
|
||||
kind = fields.Many2One('lims.component.kind', 'Kind')
|
||||
location = fields.Many2One('lims.component.location', 'Location')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
|
|
@ -109,6 +109,72 @@
|
|||
<menuitem action="act_component_type" id="menu_component_type"
|
||||
parent="menu_config" sequence="30"/>
|
||||
|
||||
<!-- Component Kind -->
|
||||
|
||||
<record model="ir.ui.view" id="component_kind_view_list">
|
||||
<field name="model">lims.component.kind</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">component_kind_list</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="component_kind_view_form">
|
||||
<field name="model">lims.component.kind</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">component_kind_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_component_kind">
|
||||
<field name="name">Component Kinds</field>
|
||||
<field name="res_model">lims.component.kind</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_component_kind_view_list">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="component_kind_view_list"/>
|
||||
<field name="act_window" ref="act_component_kind"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_component_kind_view_form">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="component_kind_view_form"/>
|
||||
<field name="act_window" ref="act_component_kind"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="act_component_kind" id="menu_component_kind"
|
||||
parent="menu_config" sequence="32"/>
|
||||
|
||||
<!-- Component Location -->
|
||||
|
||||
<record model="ir.ui.view" id="component_location_view_list">
|
||||
<field name="model">lims.component.location</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">component_location_list</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="component_location_view_form">
|
||||
<field name="model">lims.component.location</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">component_location_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_component_location">
|
||||
<field name="name">Component Locations</field>
|
||||
<field name="res_model">lims.component.location</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_component_location_view_list">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="component_location_view_list"/>
|
||||
<field name="act_window" ref="act_component_location"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_component_location_view_form">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="component_location_view_form"/>
|
||||
<field name="act_window" ref="act_component_location"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="act_component_location" id="menu_component_location"
|
||||
parent="menu_config" sequence="34"/>
|
||||
|
||||
<!-- Equipment Template -->
|
||||
|
||||
<record model="ir.ui.view" id="equipment_template_view_list">
|
||||
|
|
|
@ -86,6 +86,26 @@ msgctxt "field:lims.component,year_manufacturing:"
|
|||
msgid "Year of manufacturing"
|
||||
msgstr "Año de fabricación"
|
||||
|
||||
msgctxt "field:lims.component.kind,name:"
|
||||
msgid "Name"
|
||||
msgstr "Nombre"
|
||||
|
||||
msgctxt "field:lims.component.kind,product_type:"
|
||||
msgid "Product type"
|
||||
msgstr "Tipo de producto"
|
||||
|
||||
msgctxt "field:lims.component.location,name:"
|
||||
msgid "Name"
|
||||
msgstr "Nombre"
|
||||
|
||||
msgctxt "field:lims.component.type,kind:"
|
||||
msgid "Kind"
|
||||
msgstr "Clase"
|
||||
|
||||
msgctxt "field:lims.component.type,location:"
|
||||
msgid "Location"
|
||||
msgstr "Ubicación"
|
||||
|
||||
msgctxt "field:lims.component.type,name:"
|
||||
msgid "Name"
|
||||
msgstr "Nombre"
|
||||
|
@ -851,6 +871,14 @@ msgctxt "model:ir.action,name:act_component_from_party"
|
|||
msgid "Components"
|
||||
msgstr "Componentes"
|
||||
|
||||
msgctxt "model:ir.action,name:act_component_kind"
|
||||
msgid "Component Kinds"
|
||||
msgstr "Clases de componente"
|
||||
|
||||
msgctxt "model:ir.action,name:act_component_location"
|
||||
msgid "Component Locations"
|
||||
msgstr "Ubicaciones de componente"
|
||||
|
||||
msgctxt "model:ir.action,name:act_component_type"
|
||||
msgid "Component Types"
|
||||
msgstr "Tipos de componente"
|
||||
|
@ -919,6 +947,10 @@ msgctxt "model:ir.message,text:msg_brand_name_unique"
|
|||
msgid "There is already a brand with the same name"
|
||||
msgstr "Ya existe una marca con el mismo nombre"
|
||||
|
||||
msgctxt "model:ir.message,text:msg_component_kind_name_unique"
|
||||
msgid "There is already a component kind with the same name"
|
||||
msgstr "Ya existe una clase de componente con el mismo nombre"
|
||||
|
||||
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"
|
||||
|
@ -1001,6 +1033,14 @@ msgctxt "model:ir.ui.menu,name:menu_component"
|
|||
msgid "Components"
|
||||
msgstr "Componentes"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_component_kind"
|
||||
msgid "Component Kinds"
|
||||
msgstr "Clases de componente"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_component_location"
|
||||
msgid "Component Locations"
|
||||
msgstr "Ubicaciones de componente"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_component_type"
|
||||
msgid "Component Types"
|
||||
msgstr "Tipos de componente"
|
||||
|
@ -1053,6 +1093,14 @@ msgctxt "model:lims.component,name:"
|
|||
msgid "Component"
|
||||
msgstr "Componente"
|
||||
|
||||
msgctxt "model:lims.component.kind,name:"
|
||||
msgid "Component Kind"
|
||||
msgstr "Clase de componente"
|
||||
|
||||
msgctxt "model:lims.component.location,name:"
|
||||
msgid "Component Location"
|
||||
msgstr "Ubicación de componente"
|
||||
|
||||
msgctxt "model:lims.component.type,name:"
|
||||
msgid "Component Type"
|
||||
msgstr "Tipo de componente"
|
||||
|
|
|
@ -49,6 +49,9 @@
|
|||
<record model="ir.message" id="msg_component_type_name_unique">
|
||||
<field name="text">There is already a component type with the same name</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_component_kind_name_unique">
|
||||
<field name="text">There is already a component kind with the same name</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_equipment_template_unique">
|
||||
<field name="text">There is already a equipment template with the same type, brand and model</field>
|
||||
</record>
|
||||
|
|
7
lims_industry/view/component_kind_form.xml
Normal file
7
lims_industry/view/component_kind_form.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name" xexpand="1"/>
|
||||
<label name="product_type"/>
|
||||
<field name="product_type"/>
|
||||
</form>
|
5
lims_industry/view/component_kind_list.xml
Normal file
5
lims_industry/view/component_kind_list.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="name" expand="1"/>
|
||||
<field name="product_type" expand="1"/>
|
||||
</tree>
|
5
lims_industry/view/component_location_form.xml
Normal file
5
lims_industry/view/component_location_form.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name" xexpand="1"/>
|
||||
</form>
|
4
lims_industry/view/component_location_list.xml
Normal file
4
lims_industry/view/component_location_list.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="name" expand="1"/>
|
||||
</tree>
|
|
@ -4,4 +4,8 @@
|
|||
<field name="name" xexpand="1"/>
|
||||
<label name="product_type"/>
|
||||
<field name="product_type"/>
|
||||
<label name="kind"/>
|
||||
<field name="kind"/>
|
||||
<label name="location"/>
|
||||
<field name="location"/>
|
||||
</form>
|
||||
|
|
|
@ -2,4 +2,6 @@
|
|||
<tree>
|
||||
<field name="name" expand="1"/>
|
||||
<field name="product_type" expand="1"/>
|
||||
<field name="kind"/>
|
||||
<field name="location"/>
|
||||
</tree>
|
||||
|
|
Loading…
Reference in a new issue