From a570574ce07ebc698a3c1955858c29ab09e0a2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Sat, 8 Jun 2019 19:55:59 +0200 Subject: [PATCH] [FIX] b_w_shift: Shift with no start and end time When the worker has subscribed to a shift template but not yet to a shift, the shift used to generate her next shift is the first shift found in the shift template (so this is a shift that is attached to another worker from the same shift template). Now the system pays attention to not use a shift that has no start time or end time defined. --- beesdoo_website_shift/controllers/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/beesdoo_website_shift/controllers/main.py b/beesdoo_website_shift/controllers/main.py index cc1655f..8580e83 100644 --- a/beesdoo_website_shift/controllers/main.py +++ b/beesdoo_website_shift/controllers/main.py @@ -367,7 +367,9 @@ class WebsiteShiftController(http.Controller): limit=1, ) main_shift = request.env['beesdoo.shift.shift'].sudo().search( - [('task_template_id', '=', task_template[0].id)], + [('task_template_id', '=', task_template[0].id), + ('start_time', '!=', False), + ('end_time', '!=', False)], order="start_time desc", limit=1, )