mirror of https://github.com/OCA/social.git
[MIG] mail_optional_follower_notification: Migration to 17.0
parent
65e1fa4609
commit
43e38fd385
|
@ -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": "16.0.1.0.1",
|
"version": "17.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"],
|
||||||
|
|
|
@ -13,12 +13,13 @@ class TestMailOptionalFollowernotifications(TransactionCase):
|
||||||
demo_user = cls.env.ref("base.user_demo")
|
demo_user = cls.env.ref("base.user_demo")
|
||||||
cls.partner_follower = demo_user.partner_id
|
cls.partner_follower = demo_user.partner_id
|
||||||
cls.partner_no_follower = demo_user.copy().partner_id
|
cls.partner_no_follower = demo_user.copy().partner_id
|
||||||
|
cls.partner_no_follower.email = "test@example.com"
|
||||||
cls.partner_01.message_subscribe(partner_ids=[cls.partner_follower.id])
|
cls.partner_01.message_subscribe(partner_ids=[cls.partner_follower.id])
|
||||||
ctx = cls.env.context.copy()
|
ctx = cls.env.context.copy()
|
||||||
ctx.update(
|
ctx.update(
|
||||||
{
|
{
|
||||||
"default_model": "res.partner",
|
"default_model": "res.partner",
|
||||||
"default_res_id": cls.partner_01.id,
|
"default_res_ids": [cls.partner_01.id],
|
||||||
"default_composition_mode": "comment",
|
"default_composition_mode": "comment",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -27,13 +28,12 @@ class TestMailOptionalFollowernotifications(TransactionCase):
|
||||||
|
|
||||||
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.mail_compose_context
|
"subject": "Your subject here",
|
||||||
)._onchange_template_id(False, "comment", "res.partner", self.partner_01.id)[
|
"body": "Your plain text body here",
|
||||||
"value"
|
"partner_ids": [(6, 0, recipients.ids)],
|
||||||
]
|
"notify_followers": notify_followers,
|
||||||
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
|
values
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
<xpath expr="//span[@name='document_followers_text']" position="before">
|
<xpath expr="//span[@name='document_followers_text']" position="before">
|
||||||
<field
|
<field
|
||||||
name="notify_followers"
|
name="notify_followers"
|
||||||
attrs="{'invisible': [('composition_mode', '=', 'mass_mail')]}"
|
invisible="composition_mode == 'mass_mail'"
|
||||||
/>
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//span[@name='document_followers_text']" position="after">
|
<xpath expr="//span[@name='document_followers_text']" position="after">
|
||||||
<span
|
<span
|
||||||
name="no_followers_text"
|
name="no_followers_text"
|
||||||
attrs="{'invisible': [('notify_followers', '=', True)]}"
|
invisible="notify_followers"
|
||||||
style="color: red;"
|
style="color: red;"
|
||||||
> - Warning : Followers will not be notified but they can access the notification directly from the document (if they are allowed to)</span>
|
> - Warning : Followers will not be notified but they can access the notification directly from the document (if they are allowed to)</span>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
Loading…
Reference in New Issue