diff --git a/addons/google_calendar/google_calendar.py b/addons/google_calendar/google_calendar.py index b942400dcb5..5bb0fda4b1f 100644 --- a/addons/google_calendar/google_calendar.py +++ b/addons/google_calendar/google_calendar.py @@ -422,9 +422,10 @@ class google_calendar(osv.AbstractModel): if self.get_need_synchro_attendee(cr, uid, context=context): for google_attendee in single_event_dict.get('attendees', []): + partner_email = google_attendee.get('email', False) if type == "write": for oe_attendee in event['attendee_ids']: - if oe_attendee.email == google_attendee['email']: + if oe_attendee.email == partner_email: calendar_attendee_obj.write(cr, uid, [oe_attendee.id], {'state': google_attendee['responseStatus'], 'google_internal_event_id': single_event_dict.get('id')}, context=context) google_attendee['found'] = True continue @@ -432,12 +433,12 @@ class google_calendar(osv.AbstractModel): if google_attendee.get('found'): continue - attendee_id = res_partner_obj.search(cr, uid, [('email', '=', google_attendee['email'])], context=context) + attendee_id = res_partner_obj.search(cr, uid, [('email', '=', partner_email)], context=context) if not attendee_id: data = { - 'email': google_attendee.get('email', False), + 'email': partner_email, 'customer': False, - 'name': google_attendee.get("displayName", False) or google_attendee['email'] + 'name': google_attendee.get("displayName", False) or partner_email } attendee_id = [res_partner_obj.create(cr, uid, data, context=context)] attendee = res_partner_obj.read(cr, uid, attendee_id[0], ['email'], context=context)