[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
This commit is contained in:
Martin Trigaux
2018-09-27 10:33:33 +02:00
parent 17416e664c
commit 2c26fc0e86
+1 -1
View File
@@ -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()