From 63440c5375f1654e2029ccaeb522c764e65285b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Tue, 27 Mar 2018 14:42:57 +0200 Subject: [PATCH] [IMP] website_shift: Future alert date The future alert date has moved to beesdoo_shift module. So we use this one instead of re-compute it in the controller. --- beesdoo_website_shift/controllers/main.py | 21 +------------------ .../views/my_shift_website_templates.xml | 8 +++---- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/beesdoo_website_shift/controllers/main.py b/beesdoo_website_shift/controllers/main.py index a3e6e5b..64e0b87 100644 --- a/beesdoo_website_shift/controllers/main.py +++ b/beesdoo_website_shift/controllers/main.py @@ -5,7 +5,6 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from ast import literal_eval -from copy import copy from datetime import datetime, timedelta from itertools import groupby @@ -14,8 +13,7 @@ from openerp.http import request from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT as DATETIME_FORMAT from openerp.addons.beesdoo_shift.models.planning import float_to_time - -PERIOD = 28 # TODO: use the same constant as in 'beesdoo_shift' +from openerp.addons.beesdoo_shift.models.cooperative_status import PERIOD class WebsiteShiftController(http.Controller): @@ -126,10 +124,6 @@ class WebsiteShiftController(http.Controller): """ Return template variables for 'beesdoo_website_shift.my_shift_irregular_worker' template """ - # Get current user - cur_user = request.env['res.users'].browse(request.uid) - cur_cooperative_status = cur_user.partner_id.cooperative_status_ids - # Get config irregular_enable_sign_up = literal_eval(request.env['ir.config_parameter'].get_param( 'beesdoo_website_shift.irregular_enable_sign_up')) @@ -144,19 +138,6 @@ class WebsiteShiftController(http.Controller): irregular_enable_sign_up, nexturl )) - future_alert_date = False - if not cur_cooperative_status.alert_start_time: - # Compute date before which the worker is up to date - today_date = fields.Date.from_string(cur_cooperative_status.today) - delta = (today_date - fields.Date.from_string(cur_cooperative_status.irregular_start_date)).days - future_alert_date = today_date + timedelta(days=(cur_cooperative_status.sr + 1) * PERIOD - delta % PERIOD) - future_alert_date = future_alert_date.strftime('%Y-%m-%d') - - template_context.update( - { - 'future_alert_date': future_alert_date, - } - ) return template_context def my_shift_regular_worker(self): diff --git a/beesdoo_website_shift/views/my_shift_website_templates.xml b/beesdoo_website_shift/views/my_shift_website_templates.xml index dceac9c..1101a60 100644 --- a/beesdoo_website_shift/views/my_shift_website_templates.xml +++ b/beesdoo_website_shift/views/my_shift_website_templates.xml @@ -602,7 +602,7 @@
-
+
@@ -730,9 +730,9 @@

-

+

- +

@@ -776,7 +776,7 @@

-
+

Please, subscribe, in priority, to the highlighted shifts. To sign up to a shift click on the subscribe button. Notice that you can not unsubscribe online. To unsubscribe to a shift, please,