diff --git a/beesdoo_shift/__openerp__.py b/beesdoo_shift/__openerp__.py index 3344656..371f8dd 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.2.3', + 'version': '9.0.1.2.4', 'depends': ['beesdoo_base'], diff --git a/beesdoo_shift/wizard/subscribe.py b/beesdoo_shift/wizard/subscribe.py index 38053f6..d7986c0 100644 --- a/beesdoo_shift/wizard/subscribe.py +++ b/beesdoo_shift/wizard/subscribe.py @@ -48,7 +48,11 @@ class Subscribe(models.TransientModel): return def _get_nb_shifts(self): - return len(self.env['res.partner'].browse(self._context.get('active_id')).subscribed_shift_ids) + if len(self.env['res.partner'].browse(self._context.get('active_id')).subscribed_shift_ids) > 1: + return _("Current worker has more than one shift, " + "subscribing him to a new shift will erase all previous shifts.") + else: + return "" def _get_super(self): return self.env['res.partner'].browse(self._context.get('active_id')).super @@ -72,7 +76,7 @@ class Subscribe(models.TransientModel): ) exempt_reason_id = fields.Many2one('cooperative.exempt.reason', 'Exempt Reason') shift_id = fields.Many2one('beesdoo.shift.template', default=_get_shift) - nb_shifts = fields.Integer(string='Number of shifts', default=_get_nb_shifts) + nb_shifts_warning = fields.Char(default=_get_nb_shifts, readonly=True) reset_counter = fields.Boolean(default=_get_reset_counter_default) reset_compensation_counter = fields.Boolean(default=False) unsubscribed = fields.Boolean(default=False, string="Are you sure to unsubscribe this cooperator") diff --git a/beesdoo_shift/wizard/subscribe.xml b/beesdoo_shift/wizard/subscribe.xml index 97b0333..82c393a 100644 --- a/beesdoo_shift/wizard/subscribe.xml +++ b/beesdoo_shift/wizard/subscribe.xml @@ -16,16 +16,13 @@ -