|
@ -222,8 +222,15 @@ class CooperativeStatus(models.Model): |
|
|
data['alert_start_time'] = False |
|
|
data['alert_start_time'] = False |
|
|
self.write(data) |
|
|
self.write(data) |
|
|
if new_state == 'unsubscribed' or new_state == 'resigning': |
|
|
if new_state == 'unsubscribed' or new_state == 'resigning': |
|
|
|
|
|
# Remove worker from task_templates |
|
|
self.cooperator_id.sudo().write( |
|
|
self.cooperator_id.sudo().write( |
|
|
{'subscribed_shift_ids': [(5, 0, 0)]}) |
|
|
{'subscribed_shift_ids': [(5, 0, 0)]}) |
|
|
|
|
|
# Remove worker from supercoop in task_templates |
|
|
|
|
|
task_tpls = self.env['beesdoo.shift.template'].search( |
|
|
|
|
|
[('super_coop_id', 'in', self.cooperator_id.user_ids.ids)] |
|
|
|
|
|
) |
|
|
|
|
|
task_tpls.write({'super_coop_id': False}) |
|
|
|
|
|
# Remove worker for future task (remove also supercoop) |
|
|
# TODO: Add one day otherwise unsubscribed from the shift you were absent |
|
|
# TODO: Add one day otherwise unsubscribed from the shift you were absent |
|
|
self.env['beesdoo.shift.shift'].sudo().unsubscribe_from_today( |
|
|
self.env['beesdoo.shift.shift'].sudo().unsubscribe_from_today( |
|
|
[self.cooperator_id.id], today=fields.Date.today()) |
|
|
[self.cooperator_id.id], today=fields.Date.today()) |
|
|