From 69719f598aad2eb8ff87687bc47900030688f0ce Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 14 Feb 2019 10:51:44 +0000 Subject: [PATCH] [FIX] google_calendar: case insensitive attendee sync In Odoo, create a user John@example.com (the cap is on purpose) In Google Calendar, create an event and invite john@example.com Sync your Google calendar. Before this revision, the event created in Odoo did not add John@example.com, but created a new attendee, john@example.com, because of the sensitive casing. Besides, give the priority to partners having users, so if there are two partners with the same email, one of them having a user, e.g. John@example.com (with user) & john@example.com (without user), set the partner having the user as attendee, as its the one with the user who use the Odoo calendar, and potentially the Google sync as well. opw-1925592 closes odoo/odoo#31111 --- addons/google_calendar/models/google_calendar.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/google_calendar/models/google_calendar.py b/addons/google_calendar/models/google_calendar.py index 79af1da72d8..f231b25e18f 100644 --- a/addons/google_calendar/models/google_calendar.py +++ b/addons/google_calendar/models/google_calendar.py @@ -443,7 +443,9 @@ class GoogleCalendar(models.AbstractModel): if google_attendee.get('found'): continue - attendee = ResPartner.search([('email', '=', google_attendee['email'])], limit=1) + attendee = ResPartner.search([('email', '=ilike', google_attendee['email']), ('user_ids', '!=', False)], limit=1) + if not attendee: + attendee = ResPartner.search([('email', '=ilike', google_attendee['email'])], limit=1) if not attendee: data = { 'email': partner_email,