From 8be82305123104d4d4db883ee7ae55fa2711cdb3 Mon Sep 17 00:00:00 2001 From: "Abdelouahab (abla)" Date: Thu, 14 Dec 2023 12:30:44 +0100 Subject: [PATCH] [FIX] calendar: event of done activity must not be deleted To reproduce ============ - Create a meeting activity from any document (for example CRM opportunity) with a calendar. - It will create a meeting in the calendar. - Now, mark as done the activity created and it will delete the meeting from the calendar too. revert of https://github.com/odoo/odoo/pull/144526 opw-3626773 closes odoo/odoo#146421 X-original-commit: 0b183299a8ef7361d28d9d2b49cc56b74bfb2b46 Signed-off-by: Abdelouahab Laaroussi (abla) --- addons/calendar/models/mail_activity.py | 5 +---- addons/calendar/tests/test_mail_activity_mixin.py | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/calendar/models/mail_activity.py b/addons/calendar/models/mail_activity.py index 43d6743eece..da30c6629d4 100644 --- a/addons/calendar/models/mail_activity.py +++ b/addons/calendar/models/mail_activity.py @@ -39,10 +39,7 @@ class MailActivity(models.Model): return super(MailActivity, self)._action_done(feedback=feedback, attachment_ids=attachment_ids) def unlink_w_meeting(self): - return self.unlink() - - def unlink(self): events = self.mapped('calendar_event_id') - res = super().unlink() + res = self.unlink() events.unlink() return res diff --git a/addons/calendar/tests/test_mail_activity_mixin.py b/addons/calendar/tests/test_mail_activity_mixin.py index 70c5768b10f..c991b407209 100644 --- a/addons/calendar/tests/test_mail_activity_mixin.py +++ b/addons/calendar/tests/test_mail_activity_mixin.py @@ -77,3 +77,6 @@ class TestMailActivityMixin(MailCommon): self.assertEqual(test_record.activity_calendar_event_id.name, ev1.name, "This should be the calendar event of the next activity") act1._action_done(feedback="Mark activity as done with text") + + self.assertFalse(act1.exists(), "activity marked as done should be deleted") + self.assertTrue(ev1.exists(), "event of done activity must not be deleted")