From fd2b28eabe621ef414de90010cfe09fa45631747 Mon Sep 17 00:00:00 2001 From: Robin Goots Date: Wed, 9 Mar 2022 16:02:48 +0100 Subject: [PATCH] [MIG] mail_optional_follower_notificatio: Migration to 15.0 --- mail_optional_follower_notification/__manifest__.py | 2 +- .../models/mail_thread.py | 5 +---- .../readme/CONTRIBUTORS.rst | 1 + .../test_mail_optional_follower_notifications.py | 12 ++++++------ .../wizard/mail_compose_message.py | 4 ++-- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/mail_optional_follower_notification/__manifest__.py b/mail_optional_follower_notification/__manifest__.py index dfa5c76..42ab210 100644 --- a/mail_optional_follower_notification/__manifest__.py +++ b/mail_optional_follower_notification/__manifest__.py @@ -6,7 +6,7 @@ "author": "ACSONE SA/NV," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/social", "category": "Social Network", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "license": "AGPL-3", "depends": ["mail"], "data": ["wizard/mail_compose_message_view.xml"], diff --git a/mail_optional_follower_notification/models/mail_thread.py b/mail_optional_follower_notification/models/mail_thread.py index a9da2b5..5829805 100644 --- a/mail_optional_follower_notification/models/mail_thread.py +++ b/mail_optional_follower_notification/models/mail_thread.py @@ -26,8 +26,5 @@ class MailThread(models.AbstractModel): if msg_vals else message.sudo().partner_ids.ids ) - recipient_data = { - "partners": [d for d in recipient_data["partners"] if d["id"] in pids], - "channels": [], - } + recipient_data = [d for d in recipient_data if d["id"] in pids] return recipient_data diff --git a/mail_optional_follower_notification/readme/CONTRIBUTORS.rst b/mail_optional_follower_notification/readme/CONTRIBUTORS.rst index bea4300..7b5c64d 100644 --- a/mail_optional_follower_notification/readme/CONTRIBUTORS.rst +++ b/mail_optional_follower_notification/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Adrien Peiffer * Laurent Mignon * Andrea Stirpe +* Robin Goots diff --git a/mail_optional_follower_notification/tests/test_mail_optional_follower_notifications.py b/mail_optional_follower_notification/tests/test_mail_optional_follower_notifications.py index af05940..8932d4f 100644 --- a/mail_optional_follower_notification/tests/test_mail_optional_follower_notifications.py +++ b/mail_optional_follower_notification/tests/test_mail_optional_follower_notifications.py @@ -1,10 +1,10 @@ # Copyright 2019 ACSONE SA/NV () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo.tests.common import SavepointCase +from odoo.tests.common import TransactionCase -class TestMailOptionalFollowernotifications(SavepointCase): +class TestMailOptionalFollowernotifications(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() @@ -29,16 +29,16 @@ class TestMailOptionalFollowernotifications(SavepointCase): def _send_mail(self, recipients, notify_followers): old_messages = self.env["mail.message"].search([]) values = self.MailCompose.with_context( - self.mail_compose_context - ).onchange_template_id(False, "comment", "res.partner", self.partner_01.id)[ + **self.mail_compose_context + )._onchange_template_id(False, "comment", "res.partner", self.partner_01.id)[ "value" ] values["partner_ids"] = [(6, 0, recipients.ids)] values["notify_followers"] = notify_followers - composer = self.MailCompose.with_context(self.mail_compose_context).create( + composer = self.MailCompose.with_context(**self.mail_compose_context).create( values ) - composer.send_mail() + composer.action_send_mail() return self.env["mail.message"].search([]) - old_messages def test_1(self): diff --git a/mail_optional_follower_notification/wizard/mail_compose_message.py b/mail_optional_follower_notification/wizard/mail_compose_message.py index 7a32f10..151e19e 100644 --- a/mail_optional_follower_notification/wizard/mail_compose_message.py +++ b/mail_optional_follower_notification/wizard/mail_compose_message.py @@ -9,8 +9,8 @@ class MailComposeMessage(models.TransientModel): notify_followers = fields.Boolean(default=True) - def send_mail(self, auto_commit=False): + def _action_send_mail(self, auto_commit=False): for wizard in self: wizard = wizard.with_context(notify_followers=wizard.notify_followers) - super(MailComposeMessage, wizard).send_mail(auto_commit=auto_commit) + super(MailComposeMessage, wizard)._action_send_mail(auto_commit=auto_commit) return True