fix date comparison bug for full-day events
This commit is contained in:
parent
f5e1751da7
commit
03ca1649c9
2 changed files with 5 additions and 2 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "CalDAV Synchronization",
|
"name": "CalDAV Synchronization",
|
||||||
"version": "18.0.0.8.0",
|
"version": "18.0.0.8.1",
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"category": "Productivity",
|
"category": "Productivity",
|
||||||
"summary": "Synchronize Odoo Calendar Events with CalDAV Servers",
|
"summary": "Synchronize Odoo Calendar Events with CalDAV Servers",
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from odoo.addons.calendar.models.calendar_recurrence import MAX_RECURRENT_EVENT
|
||||||
import caldav
|
import caldav
|
||||||
from caldav.lib.error import NotFoundError
|
from caldav.lib.error import NotFoundError
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime, date
|
||||||
from icalendar import vCalAddress, vText, vDatetime, vRecur, Event, vDate
|
from icalendar import vCalAddress, vText, vDatetime, vRecur, Event, vDate
|
||||||
import re
|
import re
|
||||||
from pytz import timezone, utc
|
from pytz import timezone, utc
|
||||||
|
|
@ -652,6 +652,9 @@ class CalendarEvent(models.Model):
|
||||||
if not existing_instance:
|
if not existing_instance:
|
||||||
# If the event is in the past, we just ignore it.
|
# If the event is in the past, we just ignore it.
|
||||||
stop = values.get("stop")
|
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):
|
if stop and stop < datetime.now(tz=None):
|
||||||
continue
|
continue
|
||||||
# If we're creating an instance and it doesn't follow the recurrence,
|
# If we're creating an instance and it doesn't follow the recurrence,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue