From 77cb5f0ee069feed7189c7273ff0c5c68b5a0e66 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 10 May 2016 14:37:56 +0200 Subject: [PATCH] [FIX] calendar: edition of events duration In event not during all day, it looks like `start_date` could be defined, but `stop_date` not. Despite the fact this is not such a normal state, this should not prevent the save of the event with the `_check_closing_date` constraint, checking that the ending date is after the starting date (in the case of an event not during the whole day, this is ensured with the `start_datetime` and the `stop_datetime` opw-676245 --- addons/calendar/calendar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index 46d0fbb38c3..08464fe1b97 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -961,9 +961,9 @@ class calendar_event(osv.Model): def _check_closing_date(self, cr, uid, ids, context=None): for event in self.browse(cr, uid, ids, context=context): - if event.start_datetime and event.stop_datetime < event.start_datetime: + if event.start_datetime and event.stop_datetime and event.stop_datetime < event.start_datetime: return False - if event.start_date and event.stop_date < event.start_date: + if event.start_date and event.stop_date and event.stop_date < event.start_date: return False return True