From 03ca1649c9b4a468dde7f258be467f2375091d59 Mon Sep 17 00:00:00 2001 From: Marc Durepos Date: Thu, 21 Aug 2025 14:16:05 -0400 Subject: [PATCH] fix date comparison bug for full-day events --- caldav_sync/__manifest__.py | 2 +- caldav_sync/models/calendar_event.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/caldav_sync/__manifest__.py b/caldav_sync/__manifest__.py index 15f5564..dd634ee 100644 --- a/caldav_sync/__manifest__.py +++ b/caldav_sync/__manifest__.py @@ -8,7 +8,7 @@ { "name": "CalDAV Synchronization", - "version": "18.0.0.8.0", + "version": "18.0.0.8.1", "license": "LGPL-3", "category": "Productivity", "summary": "Synchronize Odoo Calendar Events with CalDAV Servers", diff --git a/caldav_sync/models/calendar_event.py b/caldav_sync/models/calendar_event.py index 0d6cc7c..950a182 100644 --- a/caldav_sync/models/calendar_event.py +++ b/caldav_sync/models/calendar_event.py @@ -7,7 +7,7 @@ from odoo.addons.calendar.models.calendar_recurrence import MAX_RECURRENT_EVENT import caldav from caldav.lib.error import NotFoundError import logging -from datetime import datetime +from datetime import datetime, date from icalendar import vCalAddress, vText, vDatetime, vRecur, Event, vDate import re from pytz import timezone, utc @@ -652,6 +652,9 @@ class CalendarEvent(models.Model): if not existing_instance: # If the event is in the past, we just ignore it. stop = values.get("stop") + # Normalize date-only values to datetime for safe comparison + if isinstance(stop, date) and not isinstance(stop, datetime): + stop = datetime.combine(stop, datetime.min.time()) if stop and stop < datetime.now(tz=None): continue # If we're creating an instance and it doesn't follow the recurrence,