view invisible in 'features' and 'calibration'

This commit is contained in:
sinergia 2022-07-26 21:23:12 -05:00
parent 720710e094
commit af32d1c9fb

View File

@ -7,7 +7,7 @@ from trytond.pyson import Bool, If, Eval, Id
from trytond.exceptions import UserError from trytond.exceptions import UserError
_RISK = [('N/A', "No aplíca"), _RISK = [('n/a', "No aplíca"),
('uno', 'I'), ('uno', 'I'),
('dosA', 'IIA'), ('dosA', 'IIA'),
('dosB', 'IIB')] ('dosB', 'IIB')]
@ -18,7 +18,7 @@ _USE = [('', ""),
('apoyo', 'Apoyo')] ('apoyo', 'Apoyo')]
_BIOMEDICAL_CLASS = [ _BIOMEDICAL_CLASS = [
('N/A', "No aplíca"), ('n/a', "No aplíca"),
('diagnostico', 'Diagnóstico'), ('diagnostico', 'Diagnóstico'),
('rehabilitación', 'Rehabilitación')] ('rehabilitación', 'Rehabilitación')]
@ -167,6 +167,16 @@ class Template(metaclass=PoolMeta):
depends=['resolution_type']) depends=['resolution_type'])
Usubi = fields.Integer("Usub i") Usubi = fields.Integer("Usub i")
@classmethod
def view_attributes(cls):
return super(Template, cls).view_attributes() + [
('//page[@id="features"]', 'states', {
'invisible': ~Eval('equipment'),
}),
('//page[@id="calibration"]', 'states', {
'invisible': ~Eval('calibration')},)
]
@classmethod @classmethod
@fields.depends('temperature') @fields.depends('temperature')
def default_temperature_uom(self): def default_temperature_uom(self):
@ -211,7 +221,7 @@ class Template(metaclass=PoolMeta):
@staticmethod @staticmethod
def default_risk(): def default_risk():
return None return 'n/a'
@staticmethod @staticmethod
def default_use(): def default_use():
@ -219,7 +229,7 @@ class Template(metaclass=PoolMeta):
@staticmethod @staticmethod
def default_biomedical_class(): def default_biomedical_class():
return None return 'n/a'
@staticmethod @staticmethod
def default_main_tecnology(): def default_main_tecnology():
@ -243,6 +253,7 @@ class Template(metaclass=PoolMeta):
if self.equipment: if self.equipment:
self.replacement=False self.replacement=False
self.maintenance_activity=False self.maintenance_activity=False
self.calibration=False
@fields.depends('mark_category', 'model_category', 'reference_category') @fields.depends('mark_category', 'model_category', 'reference_category')
def on_change_mark_category(self): def on_change_mark_category(self):
@ -262,19 +273,5 @@ class Template(metaclass=PoolMeta):
self.voltageDC = None self.voltageDC = None
self.frequency = None self.frequency = None
@classmethod
def view_attributes(cls):
return super(Template, cls).view_attributes() + [
('//page[@id="features"]', 'states', {
'invisible': ~Eval('equipment'),
})]
@classmethod
def view_attributes(cls):
return super(Template, cls).view_attributes() + [
('//page[@id="calibration"]', 'states', {
'invisible': ~Eval('calibration'),
})]
class Product(metaclass=PoolMeta): class Product(metaclass=PoolMeta):
__name__ = 'product.product' __name__ = 'product.product'