From 96ba378c57223af79c502bb2e92ce8c3d604aa24 Mon Sep 17 00:00:00 2001 From: cosmos Date: Wed, 14 Dec 2022 19:32:14 -0500 Subject: [PATCH] Maintenance Activities add Template Product --- locale/es.po | 4 ++++ maintenance.py | 46 ++++++++++++--------------------------- move.py | 8 ++++++- product.py | 9 ++++++++ view/maintenance_form.xml | 2 -- view/template_form.xml | 14 ++++++++++++ 6 files changed, 48 insertions(+), 35 deletions(-) diff --git a/locale/es.po b/locale/es.po index 1d0bc4a..069ce94 100644 --- a/locale/es.po +++ b/locale/es.po @@ -18,6 +18,10 @@ msgctxt "view:product.template:" msgid "Calibration" msgstr "Calibración" +msgctxt "view:product.template:" +msgid "Maintenance Activities" +msgstr "Actividades de Mantenimiento" + msgctxt "view:product.template:" msgid "Measurements of Equipment" msgstr "Medidas del Equipo" diff --git a/maintenance.py b/maintenance.py index d1c8070..6917343 100644 --- a/maintenance.py +++ b/maintenance.py @@ -245,12 +245,11 @@ class Maintenance(Workflow, ModelSQL, ModelView): #when the maintenance is in agended status diary = fields.One2Many('optical_equipment_maintenance.diary', 'diary') #Preventive maintenance - initial_operation = fields.Boolean("Verificiación inicial de funcionamiento") + initial_operation = fields.Boolean("Verificación inicial de funcionamiento") check_equipment = fields.Boolean("Revisión del Equipo") check_electric_system = fields.Boolean("Revisión del sistema electríco") clean_int_ext = fields.Boolean("Limpieza interior y exterior") clean_eyes = fields.Boolean("Limpieza de lentes y espejos") - optical = fields.Boolean("Optical") check_calibration = fields.Boolean("Verificar Calibración") maintenance_activity = fields.One2Many('optical_equipment_maintenance.activity', 'maintenance', "Maintenance Activitys") #Calibration @@ -331,35 +330,6 @@ class Maintenance(Workflow, ModelSQL, ModelView): def default_state_agended(cls): return 'no_agenda' - @classmethod - def default_initial_operation(self): - return True - - @classmethod - def default_check_equipment(self): - return True - - @classmethod - def default_check_electric_system(self): - return True - - @classmethod - def default_clean_int_ext(self): - return True - - @classmethod - def default_clean_eyes(self): - return True - - @classmethod - def default_optical(self): - return True - - @classmethod - def default_check_calibration(self): - return True - - @fields.depends('temperature_min', 'temperature_uom') def on_change_temperature_min(self): if self.temperature_min: @@ -538,12 +508,24 @@ class Maintenance(Workflow, ModelSQL, ModelView): @fields.depends('equipment', 'patterns_equipments') def on_change_equipment(self): - if self.equipment and self.equipment.product.calibration: + if self.equipment: self.patterns_equipments = self.equipment.product.k_pattern self.equipment_calibrate = self.equipment.product.calibration + self.initial_operation = self.equipment.product.initial_operation + self.check_equipment = self.equipment.product.check_equipment + self.check_electric_system = self.equipment.product.check_electric_system + self.clean_int_ext = self.equipment.product.clean_int_ext + self.clean_eyes = self.equipment.product.clean_eyes + self.check_calibration = self.equipment.product.check_calibration else: self.patterns_equipments = None self.equipment_calibrate = False + self.initial_operation = False + self.check_equipment = False + self.check_electric_system = False + self.clean_int_ext = False + self.clean_eyes = False + self.check_calibration = False @classmethod @ModelView.button diff --git a/move.py b/move.py index 7bdcd90..c6ec8a5 100644 --- a/move.py +++ b/move.py @@ -164,7 +164,13 @@ class ShipmentOut(metaclass=PoolMeta): propietary=shipment.customer.id, equipment_calibrate= True if move.equipment.product.calibration else False, propietary_address=shipment.delivery_address.id, - equipment=move.equipment.id) + equipment=move.equipment.id, + initial_operation = move.equipment.product.initial_operation, + check_equipment = move.equipment.product.check_equipment, + check_electric_system = move.equipment.product.check_electric_system, + clean_int_ext = move.equipment.product.clean_int_ext, + clean_eyes = move.equipment.product.clean_eyes, + check_calibration = move.equipment.product.check_calibration) maintenance.save() shipment.service_maintenance_initial = True shipment.save() diff --git a/product.py b/product.py index 57258db..787b5de 100644 --- a/product.py +++ b/product.py @@ -187,6 +187,15 @@ class Template(metaclass=PoolMeta): states={'invisible': If(Eval('resolution_type') != 'analoga', True)}, depends=['resolution_type']) Usubi = fields.Integer("Usub i",states={'required': Eval('calibration', False)},) + + #maintenance activities + initial_operation = fields.Boolean("Verificación inicial de funcionamiento") + check_equipment = fields.Boolean("Revisión del Equipo") + check_electric_system = fields.Boolean("Revisión del sistema electríco") + clean_int_ext = fields.Boolean("Limpieza interior y exterior") + clean_eyes = fields.Boolean("Limpieza de lentes y espejos") + optical = fields.Boolean("Optical") + check_calibration = fields.Boolean("Verificar Calibración") @classmethod diff --git a/view/maintenance_form.xml b/view/maintenance_form.xml index 62cbefe..632d7e4 100644 --- a/view/maintenance_form.xml +++ b/view/maintenance_form.xml @@ -33,8 +33,6 @@