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):
# 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
api.update("res.partner", [parent_id], {"makeups_to_do": parent['makeups_to_do'] + child_makeups})
# On annule les rattrapages du child
api.update('res.partner', [child_id], {"makeups_to_do": 0})
......@@ -863,7 +863,7 @@ def create_pair(request):
"type": child['shift_type'],
"partner_id": child_id,
"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',
"shift_id": False,
"type": parent['shift_type'],
......@@ -871,7 +871,6 @@ def create_pair(request):
"point_qty": -1})
elif child_makeups + parent_makeups > 2:
# 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})
for makeup in range(child_makeups):
# reset du compteur du suppléant
......@@ -880,18 +879,18 @@ def create_pair(request):
"type": child['shift_type'],
"partner_id": child_id,
"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
api.create('shift.counter.event', {"name": "passage en binôme",
"shift_id": False,
"type": parent['shift_type'],
"partner_id": parent_id,
"point_qty": -1})
try:
api.execute('res.partner', 'run_process_target_status', [])
except:
pass
# No more useful since status is fully managed by lacagette_addons modules
#try:
# api.execute('res.partner', 'run_process_target_status', [])
#except:
# pass
m = CagetteMember(child_id).unsubscribe_member()
# 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