Commit 67c555a8 by Etienne Freiss

ajout cas changement d'un makeup

parent 6b418e2a
...@@ -89,6 +89,15 @@ class CagetteShift(models.Model): ...@@ -89,6 +89,15 @@ class CagetteShift(models.Model):
shiftData = self.o_api.search_read('shift.registration', cond, fields, order ="date_begin ASC") shiftData = self.o_api.search_read('shift.registration', cond, fields, order ="date_begin ASC")
return shiftData return shiftData
def shift_is_makeup(self, id):
"""vérifie si une shift est un rattrapage"""
fields = ["is_makeup", "id"]
cond = [['id', '=', id]]
shiftData = self.o_api.search_read('shift.registration', cond, fields)
return shiftData[0]["is_makeup"]
def get_shift_calendar(self, id, start, end): def get_shift_calendar(self, id, start, end):
"""Récupère les shifts à partir de maintenant pour le calendier""" """Récupère les shifts à partir de maintenant pour le calendier"""
cond = [['date_begin', '>', datetime.datetime.now().isoformat()], cond = [['date_begin', '>', datetime.datetime.now().isoformat()],
......
...@@ -178,12 +178,15 @@ def change_shift(request): ...@@ -178,12 +178,15 @@ def change_shift(request):
if 'idNewShift' in request.POST and 'idOldShift' in request.POST: if 'idNewShift' in request.POST and 'idOldShift' in request.POST:
idOldShift = request.POST['idOldShift'] idOldShift = request.POST['idOldShift']
listRegister = [int(request.POST['idRegister'])]
data = { data = {
"idPartner": int(request.POST['idPartner']), "idPartner": int(request.POST['idPartner']),
"idShift":int(request.POST['idNewShift']), "idShift":int(request.POST['idNewShift']),
"in_ftop_team":request.POST['in_ftop_team'] "in_ftop_team":request.POST['in_ftop_team'],
"is_makeup":cs.shift_is_makeup(listRegister)
} }
should_block_service_exchange = getattr(settings, 'BLOCK_SERVICE_EXCHANGE_24H_BEFORE', False) should_block_service_exchange = getattr(settings, 'BLOCK_SERVICE_EXCHANGE_24H_BEFORE', False)
if should_block_service_exchange: if should_block_service_exchange:
# Block change if old shift is to happen in less than 24 hours # Block change if old shift is to happen in less than 24 hours
......
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