Commit f53cba2f by François COLOMBIER

Modifications mise à jour rattrapages suite création binôme

parent e5cd3108
Pipeline #3946 canceled with stage
...@@ -852,7 +852,7 @@ def create_pair(request): ...@@ -852,7 +852,7 @@ def create_pair(request):
# on transfert les rattrapages sur le parent # on transfert les rattrapages sur le parent
# Comme on annule les services du suppléant, on ajoute en makeup_to_do du titulaire les rattrapages choisis ou non du suppléant # Comme on annule les services du suppléant, on ajoute en makeup_to_do du titulaire les rattrapages choisis ou non du suppléant
api.update("res.partner", [parent_id], {"makeups_to_do": parent['makeups_to_do'] + child_makeups})
# On annule les rattrapages du child # On annule les rattrapages du child
api.update('res.partner', [child_id], {"makeups_to_do": 0}) api.update('res.partner', [child_id], {"makeups_to_do": 0})
...@@ -863,7 +863,7 @@ def create_pair(request): ...@@ -863,7 +863,7 @@ def create_pair(request):
"type": child['shift_type'], "type": child['shift_type'],
"partner_id": child_id, "partner_id": child_id,
"point_qty": 1}) "point_qty": 1})
# on retire les points au titulaire # on retire les points au titulaire, les rattrages sont automatiquement ajoutés
api.create('shift.counter.event', {"name": 'passage en binôme', api.create('shift.counter.event', {"name": 'passage en binôme',
"shift_id": False, "shift_id": False,
"type": parent['shift_type'], "type": parent['shift_type'],
...@@ -871,7 +871,6 @@ def create_pair(request): ...@@ -871,7 +871,6 @@ def create_pair(request):
"point_qty": -1}) "point_qty": -1})
elif child_makeups + parent_makeups > 2: elif child_makeups + parent_makeups > 2:
# on annule les rattrapages du suppléant et on met 2 rattrapages sur le titulaire # on annule les rattrapages du suppléant et on met 2 rattrapages sur le titulaire
api.update('res.partner', [parent_id], {"makeups_to_do": 2})
api.update('res.partner', [child_id], {"makeups_to_do": 0}) api.update('res.partner', [child_id], {"makeups_to_do": 0})
for makeup in range(child_makeups): for makeup in range(child_makeups):
# reset du compteur du suppléant # reset du compteur du suppléant
...@@ -880,18 +879,18 @@ def create_pair(request): ...@@ -880,18 +879,18 @@ def create_pair(request):
"type": child['shift_type'], "type": child['shift_type'],
"partner_id": child_id, "partner_id": child_id,
"point_qty": 1}) "point_qty": 1})
for i in range((parent_makeups + child_makeups) - 2): for i in range(abs(parent_makeups - 2)):
# màj du compteur du titulaire # màj du compteur du titulaire
api.create('shift.counter.event', {"name": "passage en binôme", api.create('shift.counter.event', {"name": "passage en binôme",
"shift_id": False, "shift_id": False,
"type": parent['shift_type'], "type": parent['shift_type'],
"partner_id": parent_id, "partner_id": parent_id,
"point_qty": -1}) "point_qty": -1})
# No more useful since status is fully managed by lacagette_addons modules
try: #try:
api.execute('res.partner', 'run_process_target_status', []) # api.execute('res.partner', 'run_process_target_status', [])
except: #except:
pass # pass
m = CagetteMember(child_id).unsubscribe_member() m = CagetteMember(child_id).unsubscribe_member()
# update child base account state # update child base account state
......
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