[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
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user