mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims_industry: brand and power in Equipment
This commit is contained in:
parent
655f374e84
commit
12955b974c
6 changed files with 35 additions and 6 deletions
|
@ -129,7 +129,10 @@ class Equipment(ModelSQL, ModelView):
|
|||
template = fields.Many2One('lims.equipment.template', 'Template',
|
||||
required=True)
|
||||
name = fields.Char('Name', required=True)
|
||||
brand = fields.Function(fields.Many2One('lims.brand', 'Brand'),
|
||||
'get_brand', searcher='search_brand')
|
||||
model = fields.Char('Model', required=True)
|
||||
power = fields.Char('Power', required=True)
|
||||
serial_number = fields.Char('Serial number')
|
||||
internal_id = fields.Char('Internal ID Code')
|
||||
latitude = fields.Numeric('Latitude', digits=(3, 14))
|
||||
|
@ -162,21 +165,32 @@ class Equipment(ModelSQL, ModelView):
|
|||
def search_party(cls, name, clause):
|
||||
return [('plant.party',) + tuple(clause[1:])]
|
||||
|
||||
def get_brand(self, name):
|
||||
if self.template:
|
||||
return self.template.brand.id
|
||||
|
||||
@classmethod
|
||||
def search_brand(cls, name, clause):
|
||||
return [('template.brand',) + tuple(clause[1:])]
|
||||
|
||||
@fields.depends('template')
|
||||
def on_change_template(self):
|
||||
pool = Pool()
|
||||
Component = pool.get('lims.component')
|
||||
|
||||
model = None
|
||||
power = None
|
||||
components = []
|
||||
if self.template:
|
||||
model = self.template.model
|
||||
power = self.template.power
|
||||
for type in self.template.component_types:
|
||||
value = Component(**Component.default_get(
|
||||
list(Component._fields.keys())))
|
||||
value.type = type.id
|
||||
components.append(value)
|
||||
self.model = model
|
||||
self.power = power
|
||||
self.components = components
|
||||
|
||||
|
||||
|
|
|
@ -126,6 +126,10 @@ msgctxt "field:lims.component.type,write_uid:"
|
|||
msgid "Write User"
|
||||
msgstr "Usuario modificación"
|
||||
|
||||
msgctxt "field:lims.equipment,brand:"
|
||||
msgid "Brand"
|
||||
msgstr "Marca"
|
||||
|
||||
msgctxt "field:lims.equipment,components:"
|
||||
msgid "Components"
|
||||
msgstr "Componentes"
|
||||
|
@ -182,6 +186,10 @@ msgctxt "field:lims.equipment,plant:"
|
|||
msgid "Plant"
|
||||
msgstr "Planta"
|
||||
|
||||
msgctxt "field:lims.equipment,power:"
|
||||
msgid "Power"
|
||||
msgstr "Potencia"
|
||||
|
||||
msgctxt "field:lims.equipment,rec_name:"
|
||||
msgid "Record Name"
|
||||
msgstr "Nombre"
|
||||
|
|
|
@ -6,12 +6,16 @@
|
|||
<field name="template"/>
|
||||
<notebook>
|
||||
<page id="general" string="General">
|
||||
<label name="model"/>
|
||||
<field name="model"/>
|
||||
<label name="plant"/>
|
||||
<field name="plant"/>
|
||||
<label name="party"/>
|
||||
<field name="party" colspan="3"/>
|
||||
<field name="party"/>
|
||||
<label name="brand"/>
|
||||
<field name="brand"/>
|
||||
<label name="model"/>
|
||||
<field name="model"/>
|
||||
<label name="power"/>
|
||||
<field name="power"/>
|
||||
<label name="serial_number"/>
|
||||
<field name="serial_number"/>
|
||||
<label name="internal_id"/>
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="template" expand="1"/>
|
||||
<field name="name" expand="1"/>
|
||||
<field name="brand" expand="1"/>
|
||||
<field name="model" expand="1"/>
|
||||
<field name="power"/>
|
||||
<field name="serial_number"/>
|
||||
<field name="internal_id"/>
|
||||
<field name="plant" expand="1"/>
|
||||
<field name="party" expand="1"/>
|
||||
<field name="missing_data"/>
|
||||
<field name="template" expand="1"/>
|
||||
</tree>
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
<field name="type" expand="1"/>
|
||||
<field name="brand" expand="1"/>
|
||||
<field name="model" expand="1"/>
|
||||
<field name="power" expand="1"/>
|
||||
</tree>
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
<field name="zip"/>
|
||||
<label name="city"/>
|
||||
<field name="city"/>
|
||||
<label name="subdivision"/>
|
||||
<field name="subdivision"/>
|
||||
<label name="country"/>
|
||||
<field name="country"/>
|
||||
<label name="subdivision"/>
|
||||
<field name="subdivision"/>
|
||||
</group>
|
||||
<group colspan="4" id="coordinates" string="GPS Coordinates">
|
||||
<label name="latitude"/>
|
||||
|
|
Loading…
Reference in a new issue