Commit 6f151f38 by Damien Moulard

fix potential error that people get more makeups than they should

parent 59273361
...@@ -23,10 +23,11 @@ class ShiftRegistration(models.Model): ...@@ -23,10 +23,11 @@ class ShiftRegistration(models.Model):
absence_status = conf.get_param("lacagette_membership.absence_status") absence_status = conf.get_param("lacagette_membership.absence_status")
if 'state' in vals and vals['state'] == absence_status: if 'state' in vals and vals['state'] == absence_status:
if self.ids: if self.ids:
# it is the case when called from "absence cron job" run in external third-party
to_add = 2 if absence_status == 'absent' else 1
for s in self.env['shift.registration']\ for s in self.env['shift.registration']\
.search([('id', 'in', self.ids)]): .search([('id', 'in', self.ids)]):
# it is the case when called from "absence cron job" run in external third-party
to_add = 2 if absence_status == 'absent' else 1
# Missing a makeup leads to have an additional makeup (the shift you initialy missed + the makeup you missed) # Missing a makeup leads to have an additional makeup (the shift you initialy missed + the makeup you missed)
if s.is_makeup is True: if s.is_makeup is True:
to_add += 1 to_add += 1
......
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