Commit 06bf7b9c by François C.

Merge branch 'ticket_3964' into 'dev_cooperatic'

Make remove 15 min at shift's end optional

See merge request !214
parents 9edc9237 278ce0b1
Pipeline #2462 passed with stage
in 1 minute 23 seconds
...@@ -453,6 +453,10 @@ ...@@ -453,6 +453,10 @@
Define duration, in hours, before shift starts within exchange is not more available, for standard shift_type member Define duration, in hours, before shift starts within exchange is not more available, for standard shift_type member
- REMOVE_15_MINUTES_AT_SHIFT_END = False
True by default. Remove 15 minutes to Odoo shift end (https://redmine.cooperatic.fr/issues/1680)
### BDM Admin ### BDM Admin
- BDM_SHOW_FTOP_BUTTON = True (by default) - BDM_SHOW_FTOP_BUTTON = True (by default)
......
...@@ -99,7 +99,7 @@ def get_list_shift_calendar(request, partner_id): ...@@ -99,7 +99,7 @@ def get_list_shift_calendar(request, partner_id):
registerPartner = cs.get_shift_partner(partner_id) registerPartner = cs.get_shift_partner(partner_id)
use_new_members_space = getattr(settings, 'USE_NEW_MEMBERS_SPACE', False) use_new_members_space = getattr(settings, 'USE_NEW_MEMBERS_SPACE', False)
remove_15_minutes_at_shift_end = getattr(settings, 'REMOVE_15_MINUTES_AT_SHIFT_END', True)
listRegisterPartner = [] listRegisterPartner = []
listMakeUpShift = [] listMakeUpShift = []
for v in registerPartner: for v in registerPartner:
...@@ -113,8 +113,8 @@ def get_list_shift_calendar(request, partner_id): ...@@ -113,8 +113,8 @@ def get_list_shift_calendar(request, partner_id):
events = [] events = []
for value in listService: for value in listService:
events.append(value)
if value['shift_type_id'][0] == 1 or getattr(settings, 'USE_STANDARD_SHIFT', True) is False: if value['shift_type_id'][0] == 1 or getattr(settings, 'USE_STANDARD_SHIFT', True) is False:
# Standard ou volant si on n'utilise pas les services standards (config)
l = set(value['registration_ids']) & set(listRegisterPartner) l = set(value['registration_ids']) & set(listRegisterPartner)
# if (int(value['seats_reserved']) == int(value['seats_max']) and len(l) > 0 ) or (int(value['seats_reserved']) < int(value['seats_max'])): # if (int(value['seats_reserved']) == int(value['seats_max']) and len(l) > 0 ) or (int(value['seats_reserved']) < int(value['seats_max'])):
if (int(value['seats_available']) > 0 or len(l) > 0 ): if (int(value['seats_available']) > 0 or len(l) > 0 ):
...@@ -134,7 +134,9 @@ def get_list_shift_calendar(request, partner_id): ...@@ -134,7 +134,9 @@ def get_list_shift_calendar(request, partner_id):
event["start"] = dateIsoUTC(value['date_begin_tz']) event["start"] = dateIsoUTC(value['date_begin_tz'])
datetime_object = datetime.datetime.strptime(value['date_end_tz'], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15) datetime_object = datetime.datetime.strptime(value['date_end_tz'], "%Y-%m-%d %H:%M:%S")
if remove_15_minutes_at_shift_end is True:
datetime_object -= datetime.timedelta(minutes=15)
event["end"] = dateIsoUTC(datetime_object.strftime("%Y-%m-%d %H:%M:%S")) event["end"] = dateIsoUTC(datetime_object.strftime("%Y-%m-%d %H:%M:%S"))
if len(l) > 0: if len(l) > 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment