From 05f69c4aec4892cf9d71462aa728214b942b7d0c Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 10 Nov 2017 17:28:46 +0100 Subject: [PATCH] / --- models/event.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/models/event.py b/models/event.py index 1c40d09..0887f02 100644 --- a/models/event.py +++ b/models/event.py @@ -31,9 +31,7 @@ class Event(models.Model): def _compute_duration(self): for event in self: if event.duration is True: - fmt = '%Y-%m-%d' t1 = fields.Datetime.from_string(event.date_end) t2 = fields.Datetime.from_string(event.date_start) - d1 = datetime.strptime(t1, fmt) - d2 = datetime.strptime(t2, fmt) - daysDiff = str((d2-d1).day) + delta = t1 - t2 + hours = delta.days * 24.0 + round(float(delta.seconds) / 3600.0)