Browse Source

[FIX] b_shift: Too late shift validation

This commit brings fix a bug that occur when a worker do a shift before
her future_alert_date and the shift was marked as attended after the
future_alert_date. In such a case, the worker fell in alert state and
get a -2. This don't fix the fact that the worker fall in alert. But
brings correction when the shift is finally marked as attended.
pull/79/head
Rémy Taymans 6 years ago
parent
commit
351a107a65
  1. 2
      beesdoo_shift/__openerp__.py
  2. 8
      beesdoo_shift/models/task.py

2
beesdoo_shift/__openerp__.py

@ -13,7 +13,7 @@
'website': "https://github.com/beescoop/Obeesdoo", 'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Cooperative management', 'category': 'Cooperative management',
'version': '0.1',
'version': '9.0.1.0.1',
'depends': ['beesdoo_base'], 'depends': ['beesdoo_base'],

8
beesdoo_shift/models/task.py

@ -203,7 +203,15 @@ class Task(models.Model):
elif self.worker_id.working_mode == 'irregular': elif self.worker_id.working_mode == 'irregular':
status = self.worker_id.cooperative_status_ids[0] status = self.worker_id.cooperative_status_ids[0]
alert_start_time = fields.Date.from_string(
self.worker_id.cooperative_status_ids[0].alert_start_time
)
start_time = fields.Date.from_string(self.start_time)
sr = self.worker_id.cooperative_status_ids[0].sr
if new_stage == DONE or new_stage == NECESSITY: if new_stage == DONE or new_stage == NECESSITY:
if start_time <= alert_start_time and sr >= -2:
data['sr'] = 2
else:
data['sr'] = 1 data['sr'] = 1
data['irregular_absence_date'] = False data['irregular_absence_date'] = False
data['irregular_absence_counter'] = 1 if status.irregular_absence_counter < 0 else 0 data['irregular_absence_counter'] = 1 if status.irregular_absence_counter < 0 else 0

Loading…
Cancel
Save