summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorArnaud Joset <arj@odoo.com>2020-11-23 13:42:01 +0000
committerArnaud Joset <arj@odoo.com>2020-11-23 13:48:31 +0000
commite1493af550bd425ca682e4db707e5a490d3d4af8 (patch)
treea65e3ccc1286af992662296117fcb11cb1f748f5 /addons
parent9fbea9f8ee193e672c855c73ad29de187f27cef1 (diff)
[FIX]: google_calendar: check write_date when syncing with google
When the database is migrated from 13.3 to 14.0, the write_date is not set on the 'calendar.event' records. During the syncing with google api, the write-date is compared to take the more recent values, leading to an inevitable crash for recently migrated databases. closes odoo/odoo#62185 Taskid: 2389374 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/google_calendar/models/google_sync.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/google_calendar/models/google_sync.py b/addons/google_calendar/models/google_sync.py
index f29302ce1f7..7fcb66f50b2 100644
--- a/addons/google_calendar/models/google_sync.py
+++ b/addons/google_calendar/models/google_sync.py
@@ -163,7 +163,8 @@ class GoogleSync(models.AbstractModel):
# This could be dangerous if google server time and odoo server time are different
updated = parse(gevent.updated)
odoo_record = self.browse(gevent.odoo_id(self.env))
- if updated >= pytz.utc.localize(odoo_record.write_date):
+ # Migration from 13.4 does not fill write_date. Therefore, we force the update from Google.
+ if not odoo_record.write_date or updated >= pytz.utc.localize(odoo_record.write_date):
vals = dict(self._odoo_values(gevent, default_reminders), need_sync=False)
odoo_record.write(vals)
synced_records |= odoo_record