Browse Source

[FIX] 0044_k - empêcher d'inscrire à un shift ou créneau si pas de régime définir: add a domain based on working mode

pull/105/head
Thibault Francois 7 years ago
committed by Elouan
parent
commit
d3156e89e4
  1. 2
      beesdoo_shift/models/planning.py
  2. 2
      beesdoo_shift/models/task.py

2
beesdoo_shift/models/planning.py

@ -86,7 +86,7 @@ class TaskTemplate(models.Model):
duration = fields.Float(help="Duration in Hour") duration = fields.Float(help="Duration in Hour")
worker_nb = fields.Integer(string="Number of worker", help="Max number of worker for this task", default=1) worker_nb = fields.Integer(string="Number of worker", help="Max number of worker for this task", default=1)
worker_ids = fields.Many2many('res.partner', string="Recurrent worker assigned", domain=[('eater', '=', 'worker_eater')])
worker_ids = fields.Many2many('res.partner', string="Recurrent worker assigned", domain=[('eater', '=', 'worker_eater'), ('working_mode', '=', 'regular')])
remaining_worker = fields.Integer(compute="_get_remaining", store=True, string="Remaining Place") remaining_worker = fields.Integer(compute="_get_remaining", store=True, string="Remaining Place")
active = fields.Boolean(default=True) active = fields.Boolean(default=True)
#For Kanban View Only #For Kanban View Only

2
beesdoo_shift/models/task.py

@ -28,7 +28,7 @@ class Task(models.Model):
task_template_id = fields.Many2one('beesdoo.shift.template') task_template_id = fields.Many2one('beesdoo.shift.template')
planning_id = fields.Many2one(related='task_template_id.planning_id', store=True) planning_id = fields.Many2one(related='task_template_id.planning_id', store=True)
task_type_id = fields.Many2one('beesdoo.shift.type', string="Task Type") task_type_id = fields.Many2one('beesdoo.shift.type', string="Task Type")
worker_id = fields.Many2one('res.partner', track_visibility='onchange', domain=[('eater', '=', 'worker_eater')])
worker_id = fields.Many2one('res.partner', track_visibility='onchange', domain=[('eater', '=', 'worker_eater'), ('working_mode', 'in', ('regular', 'irregular'))])
start_time = fields.Datetime(track_visibility='always', index=True) start_time = fields.Datetime(track_visibility='always', index=True)
end_time = fields.Datetime(track_visibility='always') end_time = fields.Datetime(track_visibility='always')
stage_id = fields.Many2one('beesdoo.shift.stage', required=True, track_visibility='onchange', default=lambda self: self.env.ref('beesdoo_shift.open')) stage_id = fields.Many2one('beesdoo.shift.stage', required=True, track_visibility='onchange', default=lambda self: self.env.ref('beesdoo_shift.open'))

Loading…
Cancel
Save