diff --git a/beesdoo_shift/models/task.py b/beesdoo_shift/models/task.py index 125d782..5950ca0 100644 --- a/beesdoo_shift/models/task.py +++ b/beesdoo_shift/models/task.py @@ -39,11 +39,22 @@ class Task(models.Model): stage_id = fields.Many2one('beesdoo.shift.stage', required=True, track_visibility='onchange', default=lambda self: self.env.ref('beesdoo_shift.open')) super_coop_id = fields.Many2one('res.users', string="Super Cooperative", domain=[('partner_id.super', '=', True)], track_visibility='onchange') color = fields.Integer(related="stage_id.color", readonly=True) - is_regular = fields.Boolean(default=False) + is_regular = fields.Boolean(default=False, string="Regular shift") + is_compensation = fields.Boolean(default=False, string="Compensation shift") replaced_id = fields.Many2one('res.partner', track_visibility='onchange', domain=[('eater', '=', 'worker_eater')]) revert_info = fields.Text(copy=False) working_mode = fields.Selection(related='worker_id.working_mode') + @api.onchange('is_regular') + def _onchange_shift_is_regular(self): + for task in self: + task.is_compensation = not task.is_regular + + @api.onchange('is_compensation') + def _onchange_shift_is_compensation(self): + for task in self: + task.is_regular = not task.is_compensation + def message_auto_subscribe(self, updated_fields, values=None): self._add_follower(values) return super(Task, self).message_auto_subscribe(updated_fields, values=values) diff --git a/beesdoo_shift/views/task.xml b/beesdoo_shift/views/task.xml index 442bfda..c75d2bd 100644 --- a/beesdoo_shift/views/task.xml +++ b/beesdoo_shift/views/task.xml @@ -102,9 +102,16 @@ - - + attrs="{'invisible': [('is_regular', '!=', True), ('is_compensation', '!=', True)]}"/> + + + Regular shift + + + + @@ -179,7 +186,7 @@ Super Coop: -
+
Regular Shift