[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
This commit is contained in:
Thibault Delavallée
2019-09-20 13:44:09 +00:00
parent 45719f7d83
commit 5989322b82
@@ -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):