From 9488fd042022934b9c767c7521b935f64853c8e9 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Sat, 6 Oct 2018 22:49:43 +0200 Subject: [PATCH] [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 --- beesdoo_shift/models/planning.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/beesdoo_shift/models/planning.py b/beesdoo_shift/models/planning.py index 2e6efcc..31d959a 100644 --- a/beesdoo_shift/models/planning.py +++ b/beesdoo_shift/models/planning.py @@ -103,6 +103,7 @@ class TaskTemplate(models.Model): day = today + timedelta(days=rec.day_nb_id.number - 1) h_begin, m_begin = floatime_to_hour_minute(rec.start_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.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, }) - return tasks \ No newline at end of file + return tasks