From 5989322b8298671c2c43fe5b5c856f87111c0197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 20 Sep 2019 10:21:25 +0000 Subject: [PATCH] [FIX] webiste_event_track: fix track creation As date is not required, trying to make a new date from it crashes. Let us set value to False to ensure always having a value (new ORM computed yay) and avoir crash (woop woop). Spotted in task ID 2075183 (sms on speakers). PR #37185 --- addons/website_event_track/models/event_track.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/website_event_track/models/event_track.py b/addons/website_event_track/models/event_track.py index 195cad6870c..cdef06a5be8 100644 --- a/addons/website_event_track/models/event_track.py +++ b/addons/website_event_track/models/event_track.py @@ -111,8 +111,11 @@ class Track(models.Model): @api.depends('date', 'duration') def _compute_end_date(self): for track in self: - delta = timedelta(minutes=60 * track.duration) - track.date_end = track.date + delta + if track.date: + delta = timedelta(minutes=60 * track.duration) + track.date_end = track.date + delta + else: + track.date_end = False @api.model def create(self, vals):