From e98f28671fdbd0e0d2ae5687ba726db5c6842edd Mon Sep 17 00:00:00 2001 From: Haresh Shyara Date: Wed, 19 Apr 2017 10:49:17 +0200 Subject: [PATCH] [IMP] maintenance : add unscheduled maintenance The feature added is a count of todo request that has no schedule date. It will also add a link in the team dashboard that redirect to all mainenance requests without a scheduled date. The count is computed in the existing function '_compute_todo_requests'. It will count requests that are not done and have no scheduled date. This commit also modify the view and add the default filter 'unscheduled' (created by a previous commit) for the action 'hr_equipment_todo_request_action_from_dashboard' which opens the maintenance request for the active team. --- addons/maintenance/models/maintenance.py | 2 ++ addons/maintenance/views/maintenance_views.xml | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/addons/maintenance/models/maintenance.py b/addons/maintenance/models/maintenance.py index bae7b83c085..62a98d5dfc0 100644 --- a/addons/maintenance/models/maintenance.py +++ b/addons/maintenance/models/maintenance.py @@ -371,6 +371,7 @@ class MaintenanceTeam(models.Model): todo_request_count_date = fields.Integer(compute='_compute_todo_requests') todo_request_count_high_priority = fields.Integer(compute='_compute_todo_requests') todo_request_count_block = fields.Integer(compute='_compute_todo_requests') + todo_request_count_unscheduled = fields.Integer(compute='_compute_todo_requests') @api.one @api.depends('request_ids.stage_id.done') @@ -380,6 +381,7 @@ class MaintenanceTeam(models.Model): self.todo_request_count_date = len(self.todo_request_ids.filtered(lambda e: e.schedule_date != False)) self.todo_request_count_high_priority = len(self.todo_request_ids.filtered(lambda e: e.priority == '3')) self.todo_request_count_block = len(self.todo_request_ids.filtered(lambda e: e.kanban_state == 'blocked')) + self.todo_request_count_unscheduled = len(self.todo_request_ids.filtered(lambda e: not e.schedule_date)) @api.one @api.depends('equipment_ids') diff --git a/addons/maintenance/views/maintenance_views.xml b/addons/maintenance/views/maintenance_views.xml index 4bf1643c8ec..9106107442c 100644 --- a/addons/maintenance/views/maintenance_views.xml +++ b/addons/maintenance/views/maintenance_views.xml @@ -691,6 +691,7 @@ +
@@ -735,6 +736,14 @@
+ +
+ +