[FIX] calendar: allow to copy event without messing with attendees
Before this commit, when an event was duplicated, the attendee records were shared between copies. Accepting an event in one event would set the same answer on the other. After this commit, the attendee records are recreated based on the partner and attendee status are reset. Taskid: 2484335 Part-of: odoo/odoo#68700
This commit is contained in:
@@ -569,6 +569,20 @@ class Meeting(models.Model):
|
||||
self.env['calendar.alarm_manager']._notify_next_alarm(partner_ids)
|
||||
return result
|
||||
|
||||
def copy(self, default=None):
|
||||
"""When an event is copied, the attendees should be recreated to avoid sharing the same attendee records
|
||||
between copies
|
||||
"""
|
||||
self.ensure_one()
|
||||
if not default:
|
||||
default = dict()
|
||||
# We need to make sure that the attendee_ids are recreated with new ids to avoid sharing attendees between events
|
||||
# The copy should not have the same attendee status than the original event
|
||||
default.update({'partner_ids': [Command.set([])], 'attendee_ids': [Command.set([])]})
|
||||
copied_event = super().copy(default)
|
||||
copied_event.write({'partner_ids': [(Command.set(self.partner_ids.ids))]})
|
||||
return copied_event
|
||||
|
||||
def _attendees_values(self, partner_commands):
|
||||
"""
|
||||
:param partner_commands: ORM commands for partner_id field (0 and 1 commands not supported)
|
||||
|
||||
Reference in New Issue
Block a user