caldav_sync: fixes #108, warning on invalid operator.

Add a type check to the values being compared when iterating over
current and changed values in a calendar event. Also, rewrite to use
dictionary comprehension for readability.
This commit is contained in:
Marc Durepos 2024-09-05 20:37:50 -04:00
parent 00eb20496c
commit aacc6b27b4
2 changed files with 9 additions and 4 deletions

View file

@ -8,7 +8,7 @@
{
"name": "CalDAV Synchronization",
"version": "17.0.0.5.7",
"version": "17.0.0.5.8",
"license": "LGPL-3",
"category": "Productivity",
"summary": "Synchronize Odoo Calendar Events with CalDAV Servers",

View file

@ -394,9 +394,14 @@ class CalendarEvent(models.Model):
)
# Don't write values that haven't changed
for key, val in values.items():
if getattr(existing_instance, key) != val:
changed_vals.update({key: values.get(key)})
changed_vals = {
key: val
for key, val in values.items()
if (cur_val := getattr(existing_instance, key))
and isinstance(cur_val, type(val))
and cur_val != val
}
if (
recurrency_vals
and recurrency_vals.get("recurrency")