[MIG] mail_optional_follower_notificatio: Migration to 15.0

This commit is contained in:
Robin Goots 2022-03-09 16:02:48 +01:00
parent 5036af73e0
commit fd2b28eabe
5 changed files with 11 additions and 13 deletions

View File

@ -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"],

View File

@ -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

View File

@ -1,3 +1,4 @@
* Adrien Peiffer <adrien.peiffer@acsone.eu>
* Laurent Mignon <laurent.mignon@acsone.eu>
* Andrea Stirpe <a.stirpe@onestein.nl>
* Robin Goots <robin.goots@dynapps.be>

View File

@ -1,10 +1,10 @@
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
# 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):

View File

@ -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