Browse Source

[FIX] Remove shifts for resigning status

And does not allow to add unsubscribed and resigning statut to a new shift
pull/105/head
nicolasjamoulle 5 years ago
committed by Elouan
parent
commit
54003dfbcc
  1. 2
      beesdoo_shift/models/cooperative_status.py
  2. 4
      beesdoo_shift/views/task.xml

2
beesdoo_shift/models/cooperative_status.py

@ -221,7 +221,7 @@ class CooperativeStatus(models.Model):
if self.working_mode != 'irregular': #Don't reset alert time for irregular
data['alert_start_time'] = False
self.write(data)
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)

4
beesdoo_shift/views/task.xml

@ -97,8 +97,8 @@
<group>
<field name="task_template_id" />
<field name="task_type_id" />
<field name="super_coop_id" />
<field name="worker_id" options="{'no_create': True, 'no_open': True}"/>
<field name="super_coop_id" domain="[('cooperative_status_ids.status', 'not in', ('unsubscribed', 'resigning'))]"/>
<field name="worker_id" options="{'no_create': True, 'no_open': True}" domain="[('cooperative_status_ids.status', 'not in', ('unsubscribed', 'resigning'))]"/>
<field name="replaced_id"
options="{'no_create': True, 'no_open': True}"
domain="[('working_mode', '=', 'regular')]"

Loading…
Cancel
Save