mirror of https://github.com/OCA/social.git
[MIG] mail_optional_follower_notificatio: Migration to 15.0
parent
2a9e8ecb2b
commit
73796a2616
|
@ -6,7 +6,7 @@
|
||||||
"author": "ACSONE SA/NV," "Odoo Community Association (OCA)",
|
"author": "ACSONE SA/NV," "Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/social",
|
"website": "https://github.com/OCA/social",
|
||||||
"category": "Social Network",
|
"category": "Social Network",
|
||||||
"version": "14.0.1.0.0",
|
"version": "15.0.1.0.0",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"depends": ["mail"],
|
"depends": ["mail"],
|
||||||
"data": ["wizard/mail_compose_message_view.xml"],
|
"data": ["wizard/mail_compose_message_view.xml"],
|
||||||
|
|
|
@ -26,8 +26,5 @@ class MailThread(models.AbstractModel):
|
||||||
if msg_vals
|
if msg_vals
|
||||||
else message.sudo().partner_ids.ids
|
else message.sudo().partner_ids.ids
|
||||||
)
|
)
|
||||||
recipient_data = {
|
recipient_data = [d for d in recipient_data if d["id"] in pids]
|
||||||
"partners": [d for d in recipient_data["partners"] if d["id"] in pids],
|
|
||||||
"channels": [],
|
|
||||||
}
|
|
||||||
return recipient_data
|
return recipient_data
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
* Adrien Peiffer <adrien.peiffer@acsone.eu>
|
* Adrien Peiffer <adrien.peiffer@acsone.eu>
|
||||||
* Laurent Mignon <laurent.mignon@acsone.eu>
|
* Laurent Mignon <laurent.mignon@acsone.eu>
|
||||||
* Andrea Stirpe <a.stirpe@onestein.nl>
|
* Andrea Stirpe <a.stirpe@onestein.nl>
|
||||||
|
* Robin Goots <robin.goots@dynapps.be>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
|
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# 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
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super().setUpClass()
|
super().setUpClass()
|
||||||
|
@ -29,16 +29,16 @@ class TestMailOptionalFollowernotifications(SavepointCase):
|
||||||
def _send_mail(self, recipients, notify_followers):
|
def _send_mail(self, recipients, notify_followers):
|
||||||
old_messages = self.env["mail.message"].search([])
|
old_messages = self.env["mail.message"].search([])
|
||||||
values = self.MailCompose.with_context(
|
values = self.MailCompose.with_context(
|
||||||
self.mail_compose_context
|
**self.mail_compose_context
|
||||||
).onchange_template_id(False, "comment", "res.partner", self.partner_01.id)[
|
)._onchange_template_id(False, "comment", "res.partner", self.partner_01.id)[
|
||||||
"value"
|
"value"
|
||||||
]
|
]
|
||||||
values["partner_ids"] = [(6, 0, recipients.ids)]
|
values["partner_ids"] = [(6, 0, recipients.ids)]
|
||||||
values["notify_followers"] = notify_followers
|
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
|
values
|
||||||
)
|
)
|
||||||
composer.send_mail()
|
composer.action_send_mail()
|
||||||
return self.env["mail.message"].search([]) - old_messages
|
return self.env["mail.message"].search([]) - old_messages
|
||||||
|
|
||||||
def test_1(self):
|
def test_1(self):
|
||||||
|
|
|
@ -9,8 +9,8 @@ class MailComposeMessage(models.TransientModel):
|
||||||
|
|
||||||
notify_followers = fields.Boolean(default=True)
|
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:
|
for wizard in self:
|
||||||
wizard = wizard.with_context(notify_followers=wizard.notify_followers)
|
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
|
return True
|
||||||
|
|
Loading…
Reference in New Issue