From af32d1c9fb0d46121980e32454008a48cb410025 Mon Sep 17 00:00:00 2001 From: sinergia Date: Tue, 26 Jul 2022 21:23:12 -0500 Subject: [PATCH] view invisible in 'features' and 'calibration' --- product.py | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/product.py b/product.py index 53b6950..47edab2 100644 --- a/product.py +++ b/product.py @@ -7,7 +7,7 @@ from trytond.pyson import Bool, If, Eval, Id from trytond.exceptions import UserError -_RISK = [('N/A', "No aplíca"), +_RISK = [('n/a', "No aplíca"), ('uno', 'I'), ('dosA', 'IIA'), ('dosB', 'IIB')] @@ -18,7 +18,7 @@ _USE = [('', ""), ('apoyo', 'Apoyo')] _BIOMEDICAL_CLASS = [ - ('N/A', "No aplíca"), + ('n/a', "No aplíca"), ('diagnostico', 'Diagnóstico'), ('rehabilitación', 'Rehabilitación')] @@ -166,7 +166,17 @@ class Template(metaclass=PoolMeta): states={'invisible': If(Eval('resolution_type') != 'analoga', True)}, depends=['resolution_type']) 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 @fields.depends('temperature') def default_temperature_uom(self): @@ -211,7 +221,7 @@ class Template(metaclass=PoolMeta): @staticmethod def default_risk(): - return None + return 'n/a' @staticmethod def default_use(): @@ -219,7 +229,7 @@ class Template(metaclass=PoolMeta): @staticmethod def default_biomedical_class(): - return None + return 'n/a' @staticmethod def default_main_tecnology(): @@ -243,6 +253,7 @@ class Template(metaclass=PoolMeta): if self.equipment: self.replacement=False self.maintenance_activity=False + self.calibration=False @fields.depends('mark_category', 'model_category', 'reference_category') def on_change_mark_category(self): @@ -260,21 +271,7 @@ class Template(metaclass=PoolMeta): if self.electrical_equipment: self.voltageAC = None self.voltageDC = 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'), - })] + self.frequency = None class Product(metaclass=PoolMeta): __name__ = 'product.product'