Browse Source

[TASK 48l] take irregular worker holidays into account: Don't change counterduring cron when they are on holidays

pull/105/head
Thibault Francois 6 years ago
committed by Elouan
parent
commit
7f5166aad8
  1. 12
      beesdoo_shift/models/cooperative_status.py

12
beesdoo_shift/models/cooperative_status.py

@ -274,8 +274,16 @@ class CooperativeStatus(models.Model):
journal = self.env['beesdoo.shift.journal'].search([('date', '=', today)])
if not journal:
journal = self.env['beesdoo.shift.journal'].create({'date': today})
irregular = self.search([('status', '!=', 'unsubscribed'), ('working_mode', '=', 'irregular'), ('irregular_start_date', '!=', False)])
domain = ['&',
'&',
'&', ('status', '!=', 'unsubscribed'),
('working_mode', '=', 'irregular'),
('irregular_start_date', '!=', False),
'|',
'|', ('holiday_start_time', '=', False), ('holiday_end_time', '=', False),
'|', ('holiday_start_time', '>', today), ('holiday_end_time', '<', today),
]
irregular = self.search(domain)
today_date = fields.Date.from_string(today)
for status in irregular:
if status.status == 'exempted':

Loading…
Cancel
Save