mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims_industry: Equipment: filter plant by party when crating from sample entry
This commit is contained in:
parent
dfeeef35aa
commit
cc4f36821b
|
@ -4,7 +4,7 @@
|
|||
|
||||
from trytond.model import ModelSQL, ModelView, fields, Unique
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import Eval, If
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
|
@ -194,7 +194,10 @@ class Equipment(ModelSQL, ModelView):
|
|||
latitude = fields.Numeric('Latitude', digits=(3, 14))
|
||||
longitude = fields.Numeric('Longitude', digits=(4, 14))
|
||||
plant = fields.Many2One('lims.plant', 'Plant',
|
||||
required=True, select=True)
|
||||
required=True, select=True,
|
||||
domain=[If(Eval('context', {}).contains('party'),
|
||||
('party', '=', Eval('context', {}).get('party', -1)),
|
||||
())])
|
||||
components = fields.One2Many('lims.component', 'equipment',
|
||||
'Components')
|
||||
year_manufacturing = fields.Integer('Year of manufacturing')
|
||||
|
|
|
@ -221,6 +221,7 @@ class CreateSampleStart(metaclass=PoolMeta):
|
|||
equipment = fields.Many2One('lims.equipment', 'Equipment',
|
||||
domain=[('party', '=', Eval('party'))],
|
||||
states={'required': Bool(Eval('ind_required'))},
|
||||
context={'party': Eval('party')},
|
||||
depends=['party', 'ind_required'])
|
||||
component = fields.Many2One('lims.component', 'Component',
|
||||
domain=[('equipment', '=', Eval('equipment'))],
|
||||
|
|
Loading…
Reference in a new issue