lims_industry: Component: show Plant and Party

This commit is contained in:
Adri?n Bernardi 2019-09-30 17:25:28 -03:00
parent 23faac959b
commit be95881f11
4 changed files with 20 additions and 0 deletions

View file

@ -210,6 +210,8 @@ class Component(ModelSQL, ModelView):
internal_id = fields.Char('Internal ID Code')
customer_description = fields.Char('Customer description')
year_manufacturing = fields.Integer('Year of manufacturing')
plant = fields.Function(fields.Many2One('lims.plant', 'Plant'),
'get_plant', searcher='search_plant')
party = fields.Function(fields.Many2One('party.party', 'Party'),
'get_party', searcher='search_party')
@ -227,6 +229,14 @@ class Component(ModelSQL, ModelView):
res += ' - ' + self.model
return res
def get_plant(self, name):
if self.equipment:
return self.equipment.plant.id
@classmethod
def search_plant(cls, name, clause):
return [('equipment.plant',) + tuple(clause[1:])]
def get_party(self, name):
if self.equipment:
return self.equipment.plant.party.id

View file

@ -70,6 +70,10 @@ msgctxt "field:lims.component,party:"
msgid "Party"
msgstr "Tercero"
msgctxt "field:lims.component,plant:"
msgid "Plant"
msgstr "Planta"
msgctxt "field:lims.component,power:"
msgid "Power"
msgstr "Potencia"

View file

@ -4,6 +4,10 @@
<field name="type"/>
<label name="equipment"/>
<field name="equipment"/>
<label name="plant"/>
<field name="plant"/>
<label name="party"/>
<field name="party"/>
<label name="brand"/>
<field name="brand"/>
<label name="model"/>

View file

@ -6,6 +6,8 @@
<field name="model"/>
<field name="serial_number"/>
<field name="internal_id"/>
<field name="plant" expand="1"/>
<field name="party" expand="1"/>
<field name="customer_description"/>
<field name="capacity"/>
<field name="power"/>