From 201582f8ea5cfdf7cced677a4c677fc7b1d4354f Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Tue, 20 Feb 2018 22:55:53 +0100 Subject: [PATCH 1/3] [ADD] Don't assign the worker if he is in holiday --- beesdoo_shift/models/planning.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/beesdoo_shift/models/planning.py b/beesdoo_shift/models/planning.py index 0e0e95b..dc8b8b7 100644 --- a/beesdoo_shift/models/planning.py +++ b/beesdoo_shift/models/planning.py @@ -140,16 +140,23 @@ class TaskTemplate(models.Model): tasks = self.env['beesdoo.shift.shift'] for rec in self: for i in xrange(0, rec.worker_nb): - worker_id = rec.worker_ids[i].id if len(rec.worker_ids) > i else False + worker_id = rec.worker_ids[i] if len(rec.worker_ids) > i else False + #remove worker in holiday + if worker_id and worker_id.cooperative_status_ids: + status = worker_id.cooperative_status_ids[0] + if status.holiday_start_time and status.holiday_end_time and \ + status.holiday_start_time <= rec.start_date[:10] and status.holiday_end_time >= rec.end_date[:10]: + worker_id = False tasks |= tasks.create({ 'name' : "%s %s (%s - %s) [%s]" % (rec.name, rec.day_nb_id.name, float_to_time(rec.start_time), float_to_time(rec.end_time), i), 'task_template_id' : rec.id, 'task_type_id' : rec.task_type_id.id, 'super_coop_id': rec.super_coop_id.id, - 'worker_id' : worker_id, + 'worker_id' : worker_id and worker_id.id or False, 'is_regular': True if worker_id else False, 'start_time' : rec.start_date, 'end_time' : rec.end_date, 'stage_id': self.env.ref('beesdoo_shift.open').id, }) + return tasks \ No newline at end of file From 3ae16519d25d144630dc51ec15e5d0a986687ddd Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Tue, 20 Feb 2018 23:04:49 +0100 Subject: [PATCH 2/3] [CHANGE] beesdoo_shift: allow to launch auto extension as group_shift_attendance AKA accueil groupe --- beesdoo_shift/views/cooperative_status.xml | 2 +- beesdoo_shift/wizard/extension.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/beesdoo_shift/views/cooperative_status.xml b/beesdoo_shift/views/cooperative_status.xml index 6e8a1aa..39322a6 100644 --- a/beesdoo_shift/views/cooperative_status.xml +++ b/beesdoo_shift/views/cooperative_status.xml @@ -10,7 +10,7 @@ type="object" groups="beesdoo_shift.group_shift_management" attrs="{'invisible': [('cooperator_type', '!=', 'share_a')]}"/>