diff options
| author | Kevin Baptiste <kba@odoo.com> | 2020-09-09 08:55:19 +0000 |
|---|---|---|
| committer | Kevin Baptiste <kba@odoo.com> | 2020-09-28 10:13:53 +0000 |
| commit | 287ee0f83ae6fd457e5356860c8a8ab5a4e66754 (patch) | |
| tree | 5339210758d844723d0ed25d72eda79a46bead0a /addons/calendar/models | |
| parent | 0c4f2fd9b2039d11f4245f54c5745543b48e8365 (diff) | |
[FIX] calendar: set attendees on quickcreate
When creating an event through the quickcreate, the user creating the
event was not set as attendee.
closes odoo/odoo#58580
Taskid: 2334943
X-original-commit: 07d799a5f676ed68fd2ffd9cd9bac3269f947ad1
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Diffstat (limited to 'addons/calendar/models')
| -rw-r--r-- | addons/calendar/models/calendar_event.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/addons/calendar/models/calendar_event.py b/addons/calendar/models/calendar_event.py index 903e5a772a7..ab446d2ff69 100644 --- a/addons/calendar/models/calendar_event.py +++ b/addons/calendar/models/calendar_event.py @@ -475,11 +475,12 @@ class Meeting(models.Model): added_partner_ids += [command[1]] if command[1] not in self.partner_ids.ids else [] # commands 0 and 1 not supported - attendees_to_unlink = self.env['calendar.attendee'].search([ - ('event_id', 'in', self.ids), - ('partner_id', 'in', removed_partner_ids), - ]) - attendee_commands += [[2, attendee.id] for attendee in attendees_to_unlink] # Removes and delete + if removed_partner_ids: + attendees_to_unlink = self.env['calendar.attendee'].search([ + ('event_id', 'in', self.ids), + ('partner_id', 'in', removed_partner_ids), + ]) + attendee_commands += [[2, attendee.id] for attendee in attendees_to_unlink] # Removes and delete attendee_commands += [ [0, 0, dict(partner_id=partner_id)] @@ -699,8 +700,9 @@ class Meeting(models.Model): activity_vals['user_id'] = user_id values['activity_ids'] = [(0, 0, activity_vals)] + self_partner_id = [(4, self.env.user.partner_id.id)] vals_list = [ - dict(vals, attendee_ids=self._attendees_values(vals['partner_ids'])) if 'partner_ids' in vals else vals + dict(vals, attendee_ids=self._attendees_values(vals.get('partner_ids', self_partner_id))) for vals in vals_list ] recurrence_fields = self._get_recurrent_fields() |
