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