diff options
| author | Adrien Widart <awt@odoo.com> | 2021-02-02 08:14:12 +0000 |
|---|---|---|
| committer | Adrien Widart <awt@odoo.com> | 2021-02-02 09:27:19 +0000 |
| commit | 7579787c101923d450217cd167f50b9fcf21c690 (patch) | |
| tree | 37342d472cf5ac18d1533a7a5b740dfe18ee9c61 /addons/microsoft_calendar | |
| parent | d4a2e6cda246b498f604ac5765a5ef5d0041a577 (diff) | |
[FIX] microsoft_calendar: add current partner to attendees
When synced, if the user has an event on Microsoft Calendar and if this
user is not the organizer (he is only an attendee), he will have to
enable "Everybody's calendars" on Odoo Calendar to see this event.
To reproduce the error:
(Need one Google/Microsoft account A01 and one Microsoft account A02)
1. With A01, on Google/Microsoft calendar, create an event and invite A02
2. On Odoo, enable the sync with Microsoft
- See [instructions](https://www.odoo.com/documentation/user/14.0/general/calendars/outlook/outlook_calendar.html)
3. Go to Odoo Calendar, click on "Sync With Outlook"
- ! The sync must be done with A02
Error: The event is not displayed. The user must enable "Everybody's
calendars" to see it.
The problem comes from the attendees creation: it uses Microsoft
attendees' email address to link a partner with the event. However,
nothing ensures or requires that A02's email address is the same than
current partner's one. As a result, it is possible that the current
partner is not among the attendees. Moreover, Microsoft does not say
which attendee is the synced one. Thus, this fix always adds the current
partner to the attendees, so he will no longer need to enable
"Everybody's calendars".
OPW-2439189
closes odoo/odoo#65387
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/microsoft_calendar')
| -rw-r--r-- | addons/microsoft_calendar/models/calendar.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/addons/microsoft_calendar/models/calendar.py b/addons/microsoft_calendar/models/calendar.py index dfb1976b472..fe0274f0453 100644 --- a/addons/microsoft_calendar/models/calendar.py +++ b/addons/microsoft_calendar/models/calendar.py @@ -125,18 +125,15 @@ class Meeting(models.Model): commands_partner = [] microsoft_attendees = microsoft_event.attendees or [] - if microsoft_event.isOrganizer: - user = microsoft_event.owner(self.env) - microsoft_attendees += [{ - 'emailAddress': {'address': user.partner_id.email}, - 'status': {'response': 'organizer'} - }] emails = [a.get('emailAddress').get('address') for a in microsoft_attendees] existing_attendees = self.env['calendar.attendee'] if microsoft_event.exists(self.env): existing_attendees = self.env['calendar.attendee'].search([ ('event_id', '=', microsoft_event.odoo_id(self.env)), ('email', 'in', emails)]) + elif self.env.user.partner_id.email not in emails: + commands_attendee += [(0, 0, {'state': 'accepted', 'partner_id': self.env.user.partner_id.id})] + commands_partner += [(4, self.env.user.partner_id.id)] attendees_by_emails = {a.email: a for a in existing_attendees} for attendee in microsoft_attendees: email = attendee.get('emailAddress').get('address') |
