mirror of https://github.com/OCA/social.git
commit
9c95cbc766
|
@ -8,7 +8,7 @@ class MailMessage(models.Model):
|
||||||
_inherit = "mail.message"
|
_inherit = "mail.message"
|
||||||
|
|
||||||
def action_wizard_forward(self):
|
def action_wizard_forward(self):
|
||||||
view = self.env.ref("mail_forward.mail_compose_message_forward_form")
|
view = self.env.ref("mail_forward.mail_compose_message_forward_form").sudo()
|
||||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||||
"mail.action_email_compose_message_wizard"
|
"mail.action_email_compose_message_wizard"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo.tests import Form, RecordCapturer, tagged
|
from odoo.tests import Form, RecordCapturer, tagged
|
||||||
from odoo.tests.common import HttpCase
|
from odoo.tests.common import HttpCase, users
|
||||||
|
|
||||||
|
from odoo.addons.mail.tests.common import mail_new_test_user
|
||||||
from odoo.addons.mail.tests.test_mail_composer import TestMailComposer
|
from odoo.addons.mail.tests.test_mail_composer import TestMailComposer
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +13,11 @@ class TestMailForward(TestMailComposer, HttpCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super().setUpClass()
|
super().setUpClass()
|
||||||
|
cls.user_test = mail_new_test_user(
|
||||||
|
cls.env,
|
||||||
|
login="user_test_forward",
|
||||||
|
groups="base.group_user,base.group_partner_manager",
|
||||||
|
)
|
||||||
cls.test_record.write({"name": "Test Forward", "email": "test@example.com"})
|
cls.test_record.write({"name": "Test Forward", "email": "test@example.com"})
|
||||||
cls.partner_follower1 = cls.env["res.partner"].create(
|
cls.partner_follower1 = cls.env["res.partner"].create(
|
||||||
{"name": "Follower1", "email": "follower1@example.com"}
|
{"name": "Follower1", "email": "follower1@example.com"}
|
||||||
|
@ -24,6 +30,7 @@ class TestMailForward(TestMailComposer, HttpCase):
|
||||||
)
|
)
|
||||||
cls.env["ir.model"]._get("res.partner").enable_forward_to = True
|
cls.env["ir.model"]._get("res.partner").enable_forward_to = True
|
||||||
|
|
||||||
|
@users("user_test_forward")
|
||||||
def test_01_mail_forward(self):
|
def test_01_mail_forward(self):
|
||||||
"""
|
"""
|
||||||
Send an email to followers
|
Send an email to followers
|
||||||
|
@ -70,6 +77,7 @@ class TestMailForward(TestMailComposer, HttpCase):
|
||||||
self.assertIn(self.partner_forward, forward_message.partner_ids)
|
self.assertIn(self.partner_forward, forward_message.partner_ids)
|
||||||
self.assertIn("---------- Forwarded message ---------", forward_message.body)
|
self.assertIn("---------- Forwarded message ---------", forward_message.body)
|
||||||
|
|
||||||
|
@users("user_test_forward")
|
||||||
def test_mail_forward_another_thread(self):
|
def test_mail_forward_another_thread(self):
|
||||||
"""
|
"""
|
||||||
Check that the email is forwarded to another thread.
|
Check that the email is forwarded to another thread.
|
||||||
|
@ -125,16 +133,20 @@ class TestMailForward(TestMailComposer, HttpCase):
|
||||||
)
|
)
|
||||||
self.assertIn("---------- Forwarded message ---------", forward_message.body)
|
self.assertIn("---------- Forwarded message ---------", forward_message.body)
|
||||||
|
|
||||||
|
@users("user_test_forward")
|
||||||
def test_02_mail_forward_tour(self):
|
def test_02_mail_forward_tour(self):
|
||||||
self.test_record.message_post(
|
self.test_record.message_post(
|
||||||
body="Hello World", message_type="comment", subtype_xmlid="mail.mt_comment"
|
body="Hello World", message_type="comment", subtype_xmlid="mail.mt_comment"
|
||||||
)
|
)
|
||||||
self.start_tour("/web", "mail_forward.mail_forward_tour", login="admin")
|
self.start_tour(
|
||||||
|
"/web", "mail_forward.mail_forward_tour", login="user_test_forward"
|
||||||
|
)
|
||||||
|
|
||||||
|
@users("user_test_forward")
|
||||||
def test_03_mail_note_not_forward_tour(self):
|
def test_03_mail_note_not_forward_tour(self):
|
||||||
self.test_record.message_post(
|
self.test_record.message_post(
|
||||||
body="This is a note", message_type="comment", subtype_xmlid="mail.mt_note"
|
body="This is a note", message_type="comment", subtype_xmlid="mail.mt_note"
|
||||||
)
|
)
|
||||||
self.start_tour(
|
self.start_tour(
|
||||||
"/web", "mail_forward.mail_note_not_forward_tour", login="admin"
|
"/web", "mail_forward.mail_note_not_forward_tour", login="user_test_forward"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue