diff --git a/addons/calendar/models/mail_activity.py b/addons/calendar/models/mail_activity.py index da30c6629d4..b8a71d4a29b 100644 --- a/addons/calendar/models/mail_activity.py +++ b/addons/calendar/models/mail_activity.py @@ -28,15 +28,21 @@ class MailActivity(models.Model): return action def _action_done(self, feedback=False, attachment_ids=False): + events = self.calendar_event_id + # To avoid the feedback to be included in the activity note (due to the synchronization in event.write + # that updates the related activity note each time the event description is updated), + # when the activity is written as a note in the chatter in _action_done (leading to duplicate feedback), + # we call super before updating the description. As self is deleted in super, we load the related events before. + messages, activities = super(MailActivity, self)._action_done(feedback=feedback, attachment_ids=attachment_ids) if feedback: - for event in self.calendar_event_id: + for event in events: description = event.description description = '%s
%s' % ( description if not tools.is_html_empty(description) else '', _('Feedback: %(feedback)s', feedback=tools.plaintext2html(feedback)) if feedback else '', ) event.write({'description': description}) - return super(MailActivity, self)._action_done(feedback=feedback, attachment_ids=attachment_ids) + return messages, activities def unlink_w_meeting(self): events = self.mapped('calendar_event_id')