[FIX] calendar: fix duplicate feedback in the chatter activity done note
How to reproduce: - install crm - open a lead - create an activity call or meeting (and schedule it in the calendar) - mark it as done with a feedback The activity log in the chatter contains the feedback twice and shouldn't. The problem was caused by the synchronization of the event description with the related activities. When marking an activity as done, the event description is updated with the feedback which in turn update the activity note with the feedback. When logging the activity done in the chatter, the note and the feedback are logged leading to a duplicate feedback. We solve this by first logging the activity done in the chatter before updating the event description. Task-3653088 closes odoo/odoo#158268 X-original-commit: 0156204e465bc7f86643152cfff4d1aa33fd6935 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
committed by
Thibault Delavallée
parent
12c327ad94
commit
a3d2336b17
@@ -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<br />%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')
|
||||
|
||||
Reference in New Issue
Block a user