From 88896bb8f5c270337d467bc43c769a05090aad3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com>
Date: Wed, 9 Feb 2022 10:58:54 +0100
Subject: [PATCH] [ADD] Update event from bluemind

---
 models/calendar_event.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/models/calendar_event.py b/models/calendar_event.py
index 6312d65..d2b81c1 100644
--- a/models/calendar_event.py
+++ b/models/calendar_event.py
@@ -45,7 +45,7 @@ PRIVACY_CONVERTER_O2B = {
 
 
 # TODO: manage attendee_ids, alarm_ids ?
-# TODO: check if recurrency prperly working
+# TODO: check if recurrency properly working
 class CalendarEvent(models.Model):
     _inherit = "calendar.event"
 
@@ -205,16 +205,14 @@ class CalendarEvent(models.Model):
         )
         return uid.decode()
 
-    # TODO: Create function to update Odoo event from Bluemind updated event
     def update_odoo_event_from_bm(self, odoo_event, bm_event):
-        return NotImplementedError()
+        new_odoo_fields = self._bm_to_odoo_values(bm_event)
+        odoo_event.write(new_odoo_fields)
 
-    # TODO: add function to update Bluemind object when Odoo object is modified
     # Take caution about attendees (only one calendar event in Odoo for all attendees,
     # when in Bluemind you get a different one per attendee)
     def write(self, values, from_bluemind=False):
         # For now this function pushes again the full event to bluemind,
-        # TODO: check if this could be improved to push only a few fields ?
         result = super().write(values)
         if result and not from_bluemind:
             bm_events = VEventChanges()
-- 
GitLab