|
|
@ -96,16 +96,23 @@ class VracoopPointRetrait(models.Model): |
|
|
|
('vracoop_point_retrait_id', '=', rec.id), |
|
|
|
('active_day', '=', False)]) |
|
|
|
count_day = rec.nb_day_available + exclure_days_nb |
|
|
|
|
|
|
|
|
|
|
|
# Ajout pour BUG |
|
|
|
corresponding_line = rec.vracoop_retrait_time_ids.search([ |
|
|
|
('vracoop_point_retrait_id', '=', rec.id), |
|
|
|
('name', '=', today_datetime.strftime("%w"))]) |
|
|
|
today_hour_available = today_datetime + timedelta( |
|
|
|
hours=(corresponding_line.preparation_time + rec.nb_hours_preparation)) |
|
|
|
|
|
|
|
# Liste des jours où je peux récupérer la commande |
|
|
|
# en fonction nombre de jour dispo sur la fiche du point retrait |
|
|
|
first_day = datetime.today() + relativedelta(hours=rec.nb_hours_preparation) |
|
|
|
first_day = datetime.today() + relativedelta(hours=corresponding_line.preparation_time + rec.nb_hours_preparation) |
|
|
|
|
|
|
|
list_week = list(rrule( |
|
|
|
DAILY, |
|
|
|
count=count_day, |
|
|
|
dtstart=first_day)) |
|
|
|
|
|
|
|
|
|
|
|
for week in list_week: |
|
|
|
# On exclut les jours où la journée |
|
|
|
# du point de retrait n'est pas actif |
|
|
@ -169,8 +176,8 @@ class VracoopPointRetrait(models.Model): |
|
|
|
|
|
|
|
# Heure disponible pour un retrait |
|
|
|
# en fonction du temps de préparation |
|
|
|
today_hour_available = today_datetime + timedelta( |
|
|
|
hours=(corresponding_line.preparation_time + rec.nb_hours_preparation)) |
|
|
|
# today_hour_available = today_datetime + timedelta( |
|
|
|
# hours=(corresponding_line.preparation_time + rec.nb_hours_preparation)) |
|
|
|
|
|
|
|
# Boucle pour les créneaux du matin |
|
|
|
for slot_elem in list_slot_per_day_morning: |
|
|
@ -192,19 +199,17 @@ class VracoopPointRetrait(models.Model): |
|
|
|
last_slot = slot_elem_last.strftime("%H:%M") |
|
|
|
|
|
|
|
# Si le jour est égal à la date du jour |
|
|
|
day_first = today_datetime.date() + relativedelta(hours=rec.nb_hours_preparation) |
|
|
|
if slot_elem.date() == day_first: |
|
|
|
if (slot_elem_last > last_morning_hour_week): |
|
|
|
if (today_hour_available > last_morning_hour_week): |
|
|
|
continue |
|
|
|
if (today_hour_available > slot_elem_last): |
|
|
|
if (slot_elem_last > last_morning_hour_week): |
|
|
|
if (today_hour_available > last_morning_hour_week): |
|
|
|
continue |
|
|
|
if (today_hour_available > slot_elem_last): |
|
|
|
continue |
|
|
|
if (today_hour_available > slot_elem): |
|
|
|
slot_elem_first = today_hour_available + timedelta( |
|
|
|
hours=1.0) |
|
|
|
first_slot = slot_elem_first.strftime("%H:00") |
|
|
|
if first_slot == last_slot: |
|
|
|
continue |
|
|
|
if (today_hour_available > slot_elem): |
|
|
|
slot_elem_first = today_hour_available + timedelta( |
|
|
|
hours=1.0) |
|
|
|
first_slot = slot_elem_first.strftime("%H:00") |
|
|
|
if first_slot == last_slot: |
|
|
|
continue |
|
|
|
|
|
|
|
# Vérification si |
|
|
|
# Nombre max de retrait défini a été atteint |
|
|
@ -241,19 +246,17 @@ class VracoopPointRetrait(models.Model): |
|
|
|
last_slot = slot_elem_last.strftime("%H:%M") |
|
|
|
|
|
|
|
# Si le jour est égal à la date du jour |
|
|
|
day_first = today_datetime.date() + relativedelta(hours=rec.nb_hours_preparation) |
|
|
|
if slot_elem.date() == day_first: |
|
|
|
if (slot_elem_last > last_noon_hour_week): |
|
|
|
if (today_hour_available > last_noon_hour_week): |
|
|
|
continue |
|
|
|
if (today_hour_available > slot_elem_last): |
|
|
|
if (slot_elem_last > last_noon_hour_week): |
|
|
|
if (today_hour_available > last_noon_hour_week): |
|
|
|
continue |
|
|
|
if (today_hour_available > slot_elem_last): |
|
|
|
continue |
|
|
|
if (today_hour_available > slot_elem): |
|
|
|
slot_elem_first = today_hour_available + timedelta( |
|
|
|
hours=1.0) |
|
|
|
first_slot = slot_elem_first.strftime("%H:00") |
|
|
|
if first_slot == last_slot: |
|
|
|
continue |
|
|
|
if (today_hour_available > slot_elem): |
|
|
|
slot_elem_first = today_hour_available + timedelta( |
|
|
|
hours=1.0) |
|
|
|
first_slot = slot_elem_first.strftime("%H:00") |
|
|
|
if first_slot == last_slot: |
|
|
|
continue |
|
|
|
# Vérification si |
|
|
|
# Nombre max de retrait défini a été atteint |
|
|
|
# Pas de controle si La valeur définie est 0 |
|
|
|