Browse Source

[FIX] Remove assignation to shift and shift template when you are resigning like unsubscribed, you subscribe after resignation you are not resigning anymore ;)

pull/50/head
Thibault Francois 6 years ago
parent
commit
601b22ea5e
  1. 2
      beesdoo_shift/models/cooperative_status.py
  2. 1
      beesdoo_shift/wizard/subscribe.py

2
beesdoo_shift/models/cooperative_status.py

@ -218,7 +218,7 @@ class CooperativeStatus(models.Model):
self.write({'alert_start_time': self.today, 'extension_start_time': False, 'time_extension': 0})
if new_state == 'ok': #reset alert start time if back to ok
self.write({'alert_start_time': False, 'extension_start_time': False, 'time_extension': 0})
if new_state == 'unsubscribed':
if new_state == 'unsubscribed' or new_state == 'resigning':
self.cooperator_id.sudo().write({'subscribed_shift_ids' : [(5,0,0)]})
#TODO: Add one day othertwise unsubscribed from the shift you were absent
self.env['beesdoo.shift.shift'].sudo().unsubscribe_from_today([self.cooperator_id.id], today=self.today)

1
beesdoo_shift/wizard/subscribe.py

@ -97,6 +97,7 @@ class Subscribe(models.TransientModel):
'irregular_start_date': self.irregular_start_date,
'irregular_absence_date': False,
'irregular_absence_counter': 0,
'resigning' : False,
}
if self.reset_counter:
data['sr'] = 0

Loading…
Cancel
Save