diff --git a/beesdoo_shift/__openerp__.py b/beesdoo_shift/__openerp__.py index 7ff8d95..baa4ec3 100644 --- a/beesdoo_shift/__openerp__.py +++ b/beesdoo_shift/__openerp__.py @@ -13,7 +13,7 @@ 'website': "https://github.com/beescoop/Obeesdoo", 'category': 'Cooperative management', - 'version': '0.1', + 'version': '9.0.1.0.1', 'depends': ['beesdoo_base'], diff --git a/beesdoo_shift/models/cooperative_status.py b/beesdoo_shift/models/cooperative_status.py index 125f36e..1a2ef20 100644 --- a/beesdoo_shift/models/cooperative_status.py +++ b/beesdoo_shift/models/cooperative_status.py @@ -222,8 +222,15 @@ class CooperativeStatus(models.Model): data['alert_start_time'] = False self.write(data) if new_state == 'unsubscribed' or new_state == 'resigning': + # Remove worker from task_templates self.cooperator_id.sudo().write( {'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 self.env['beesdoo.shift.shift'].sudo().unsubscribe_from_today( [self.cooperator_id.id], today=fields.Date.today())