diff --git a/maintenance.py b/maintenance.py index d3acfd7..c61e2ed 100644 --- a/maintenance.py +++ b/maintenance.py @@ -215,6 +215,7 @@ class Maintenance(Workflow, ModelSQL, ModelView): states={'readonly': Eval('state') == 'finished'}) maintenance_lines = fields.One2Many('optical_equipment.maintenance.line', 'maintenance', 'Lines') description_activity = fields.Char('Activity') + next_maintenance = fields.Function(fields.Date('Next Maintenance'), 'get_next_maintenance') @classmethod def __setup__(cls): @@ -286,6 +287,15 @@ class Maintenance(Workflow, ModelSQL, ModelView): def default_check_calibration(self): return True + def get_next_maintenance(self, action): + next_maintenance = None + if self.service_maintenance.estimated_agended: + if self.propietary.client_type == "ips": + next_maintenance = self.service_maintenance.estimated_agended + timedelta(days=365) + else: + next_maintenance = self.service_maintenance.estimated_agended + timedelta(days=182) + return next_maintenance + def get_standard_deviation(samples): """ This function calculated the diff --git a/maintenance.xml b/maintenance.xml index 9cddd38..0407c03 100644 --- a/maintenance.xml +++ b/maintenance.xml @@ -271,6 +271,18 @@ optical_equipment_maintenance.service,-1 + + Maintenance Service + optical_equipment.maintenance + optical_equipment.maintenance + report/maintenance_service.fodt + + + + form_print + optical_equipment.maintenance,-1 + +