Browse Source

[FIX] Bad hour for shift generated the day of timeshift, use the hour of the shift instead of 00:00:00 to call context_timestamp

pull/105/head
Thibault Francois 6 years ago
committed by Elouan
parent
commit
9488fd0420
  1. 3
      beesdoo_shift/models/planning.py

3
beesdoo_shift/models/planning.py

@ -103,6 +103,7 @@ class TaskTemplate(models.Model):
day = today + timedelta(days=rec.day_nb_id.number - 1) day = today + timedelta(days=rec.day_nb_id.number - 1)
h_begin, m_begin = floatime_to_hour_minute(rec.start_time) h_begin, m_begin = floatime_to_hour_minute(rec.start_time)
h_end, m_end = floatime_to_hour_minute(rec.end_time) h_end, m_end = floatime_to_hour_minute(rec.end_time)
day = day.replace(hour=h_begin, minute=m_begin)
rec.start_date = fields.Datetime.context_timestamp(self, day).replace(hour=h_begin, minute=m_begin, second=0).astimezone(UTC) rec.start_date = fields.Datetime.context_timestamp(self, day).replace(hour=h_begin, minute=m_begin, second=0).astimezone(UTC)
rec.end_date = fields.Datetime.context_timestamp(self, day).replace(hour=h_end, minute=m_end, second=0).astimezone(UTC) rec.end_date = fields.Datetime.context_timestamp(self, day).replace(hour=h_end, minute=m_end, second=0).astimezone(UTC)
@ -162,4 +163,4 @@ class TaskTemplate(models.Model):
'stage_id': self.env.ref('beesdoo_shift.open').id, 'stage_id': self.env.ref('beesdoo_shift.open').id,
}) })
return tasks
return tasks
Loading…
Cancel
Save