From 2c26fc0e862f72d659b86d3016d8e51ba360c6d2 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 27 Sep 2018 10:33:33 +0200 Subject: [PATCH] [FIX] calendar: do not crash on all day selection While start and stop are required fields, it is possible to trigger the computation from the UI before saving (e.g. create an event, set no date, check "all day" checkbox). Fixes #27265 --- addons/calendar/models/calendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index cc074cec5c0..c0d0afae304 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -874,7 +874,7 @@ class Meeting(models.Model): the duration for not allday meeting ; otherwise the duration is set to zero, since the meeting last all the day. """ for meeting in self: - if meeting.allday: + if meeting.allday and meeting.start and meeting.stop: meeting.start_date = meeting.start.date() meeting.start_datetime = False meeting.stop_date = meeting.stop.date()