From 6f801e6d47a02b6abdf49c65ad8e07334f57bdd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Sun, 2 Jun 2019 22:49:00 +0200 Subject: [PATCH] [ADD] b_shift: Set configurable limit to unsubscribe regular worker This adds a configurable limit under which the regular worker is unsubscribed. The regular worker is unsubscribed when the sum of his shift counter and his compensation shift counter reach the configured limit. --- beesdoo_shift/__openerp__.py | 2 +- beesdoo_shift/data/system_parameter.xml | 6 +++++- beesdoo_shift/models/cooperative_status.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/beesdoo_shift/__openerp__.py b/beesdoo_shift/__openerp__.py index ccde520..97ee7a6 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': '9.0.1.1.1', + 'version': '9.0.1.2.0', 'depends': ['beesdoo_base'], diff --git a/beesdoo_shift/data/system_parameter.xml b/beesdoo_shift/data/system_parameter.xml index 6d8b96e..299b6db 100644 --- a/beesdoo_shift/data/system_parameter.xml +++ b/beesdoo_shift/data/system_parameter.xml @@ -27,4 +27,8 @@ irregular_counter_to_unsubscribe -4 - \ No newline at end of file + + regular_counter_to_unsubscribe + -4 + + diff --git a/beesdoo_shift/models/cooperative_status.py b/beesdoo_shift/models/cooperative_status.py index 098ec4f..069637d 100644 --- a/beesdoo_shift/models/cooperative_status.py +++ b/beesdoo_shift/models/cooperative_status.py @@ -212,10 +212,11 @@ class CooperativeStatus(models.Model): def _set_regular_status(self, grace_delay, alert_delay): self.ensure_one() + counter_unsubscribe = int(self.env['ir.config_parameter'].get_param('regular_counter_to_unsubscribe', -4)) ok = self.sr >= 0 and self.sc >= 0 grace_delay = grace_delay + self.time_extension - if self.sr < -1 or self.unsubscribed: + if (self.sr + self.sc) <= counter_unsubscribe or self.unsubscribed: self.status = 'unsubscribed' self.can_shop = False elif self.today >= self.temporary_exempt_start_date and self.today <= self.temporary_exempt_end_date: