domain of values in template the equipment

This commit is contained in:
sinergia 2022-07-07 11:54:26 -05:00
parent db126e496e
commit a9f20c356f

View File

@ -24,9 +24,13 @@ class OpticalEquipment(Workflow, ModelSQL, ModelView):
company = fields.Many2One('company.company', "Company", readonly=True)
location = fields.Many2One('stock.location', "Location")
propietary = fields.Many2One('party.party', "Propietary")
propietary_address = fields.Many2One('party.address',
"Propietary Address", required=True)
product = fields.Many2One('product.product', "Product")
propietary_address = fields.Many2One('party.address', "Propietary Address", required=True,
domain=[('party', '=', Eval('propietary'))]
)
product = fields.Many2One('product.product', "Product",
domain=[('equipment', '=', True)],
depends=['equipment']
)
refurbish = fields.Boolean("Refurbish", readonly=True)
equipment_type = fields.Char('type', readonly=True)
risk = fields.Char('Type risk')
@ -95,6 +99,25 @@ class OpticalEquipment(Workflow, ModelSQL, ModelView):
@staticmethod
def default_company():
return Transaction().context.get('company')
@fields.depends('product', 'equipment_type','use',
'biomedical_class', 'calibration',
'mark_category', 'model_category')
def on_change_product(self):
if self.product:
self.equipment_type = self.product.equipment_type
self.use = self.product.use
self.biomedical_class = self.product.biomedical_class
self.calibration = self.product.calibration
self.mark_category = self.product.mark_category
self.model_category = self.product.model_category
else:
self.equipment_type = None
self.use = None
self.biomedical_class = None
self.calibration = None
self.mark_category = None
self.model_category = None
@classmethod
@ModelView.button