Commit e9d98f1c by Damien Moulard

add 2 makeups if a makeup shift is missed

parent 87d5994b
...@@ -27,6 +27,9 @@ class ShiftRegistration(models.Model): ...@@ -27,6 +27,9 @@ class ShiftRegistration(models.Model):
to_add = 2 if absence_status == 'absent' else 1 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)]):
# Missing a makeup leads to have an additional makeup (the shift you initialy missed + the makeup you missed)
if s.is_makeup is True:
to_add += 1
new_makeups_to_do = s.partner_id.makeups_to_do + to_add new_makeups_to_do = s.partner_id.makeups_to_do + to_add
s.partner_id.update({'makeups_to_do': new_makeups_to_do}) s.partner_id.update({'makeups_to_do': new_makeups_to_do})
return super(ShiftRegistration, self).write(vals) return super(ShiftRegistration, self).write(vals)
\ No newline at end of file
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