Browse Source

[ADD] 0048g- Statut démissionnaire: possible when unscribed to check the box resigning, the cooperator will be in a specific status resigning

pull/105/head
Thibault Francois 7 years ago
committed by Elouan
parent
commit
e446f21696
  1. 10
      beesdoo_shift/models/cooperative_status.py
  2. 1
      beesdoo_shift/views/cooperative_status.xml
  3. 2
      beesdoo_shift/wizard/subscribe.py
  4. 3
      beesdoo_shift/wizard/subscribe.xml

10
beesdoo_shift/models/cooperative_status.py

@ -64,11 +64,13 @@ class CooperativeStatus(models.Model):
('extension', 'Extension'),
('suspended', 'Suspended'),
('exempted', 'Exempted'),
('unsubscribed', 'Unsubscribed')],
('unsubscribed', 'Unsubscribed'),
('resigning', 'Resigning')],
compute="_compute_status", string="Cooperative Status", store=True)
can_shop = fields.Boolean(compute='_compute_status', store=True)
history_ids = fields.One2many('cooperative.status.history', 'status_id', readonly=True)
unsubscribed = fields.Boolean(default=False, help="Manually unsubscribed")
resigning = fields.Boolean(default=False, help="Want to leave the beescoop")
#Specific to irregular
irregular_start_date = fields.Date() #TODO migration script
@ -85,7 +87,7 @@ class CooperativeStatus(models.Model):
'alert_start_time', 'extension_start_time',
'unsubscribed', 'irregular_absence_date',
'irregular_absence_counter', 'temporary_exempt_start_date',
'temporary_exempt_end_date')
'temporary_exempt_end_date', 'resigning')
def _compute_status(self):
alert_delay = int(self.env['ir.config_parameter'].get_param('alert_delay', 28))
grace_delay = int(self.env['ir.config_parameter'].get_param('default_grace_delay', 10))
@ -95,6 +97,10 @@ class CooperativeStatus(models.Model):
rec.status = 'ok'
rec.can_shop = True
continue
if rec.resigning:
rec.status = 'resigning'
rec.can_shop = False
continue
if rec.working_mode == 'regular':
rec._set_regular_status(grace_delay, alert_delay)

1
beesdoo_shift/views/cooperative_status.xml

@ -80,6 +80,7 @@
<field name="sc" />
<field name="irregular_absence_counter" attrs="{'invisible':[('working_mode', '!=', 'irregular')]}" />
<field name="unsubscribed" />
<field name="resigning" />
<field name="can_shop" />
</group>
<group string="Timing information">

2
beesdoo_shift/wizard/subscribe.py

@ -52,6 +52,7 @@ class Subscribe(models.TransientModel):
reset_compensation_counter = fields.Boolean(default=False)
unsubscribed = fields.Boolean(default=False, string="Are you sure to unsubscribe this cooperator")
irregular_start_date = fields.Date(string="Start Date", default=fields.Date.today)
resigning = fields.Boolean(default=False, help="Want to leave the beescoop")
@ -65,6 +66,7 @@ class Subscribe(models.TransientModel):
data = {
'unsubscribed': True,
'cooperator_id': self.cooperator_id.id,
'resigning' : self.resigning,
}
if status_id:
status_id.sudo().write(data)

3
beesdoo_shift/wizard/subscribe.xml

@ -5,7 +5,8 @@
<field name="arch" type="xml">
<form>
<group attrs="{'invisible': [('unsubscribed', '=', False)]}">
<separator string="Are you sure to unsubscribe this cooperator ?" />
<separator string="Are you sure to unsubscribe this cooperator ?" colspan="2"/>
<field name="resigning" />
<field name="unsubscribed" invisible="1" />
</group>
<group attrs="{'invisible': [('unsubscribed', '=', True)]}">

Loading…
Cancel
Save