[MIG] mail_optional_follower_notification: Migration to 17.0

pull/1381/head
Jérémy Didderen 2024-06-04 09:08:45 +02:00
parent 65e1fa4609
commit 43e38fd385
3 changed files with 11 additions and 11 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": "16.0.1.0.1",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"depends": ["mail"],
"data": ["wizard/mail_compose_message_view.xml"],

View File

@ -13,12 +13,13 @@ class TestMailOptionalFollowernotifications(TransactionCase):
demo_user = cls.env.ref("base.user_demo")
cls.partner_follower = demo_user.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])
ctx = cls.env.context.copy()
ctx.update(
{
"default_model": "res.partner",
"default_res_id": cls.partner_01.id,
"default_res_ids": [cls.partner_01.id],
"default_composition_mode": "comment",
}
)
@ -27,13 +28,12 @@ class TestMailOptionalFollowernotifications(TransactionCase):
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)[
"value"
]
values["partner_ids"] = [(6, 0, recipients.ids)]
values["notify_followers"] = notify_followers
values = {
"subject": "Your subject here",
"body": "Your plain text body here",
"partner_ids": [(6, 0, recipients.ids)],
"notify_followers": notify_followers,
}
composer = self.MailCompose.with_context(**self.mail_compose_context).create(
values
)

View File

@ -8,13 +8,13 @@
<xpath expr="//span[@name='document_followers_text']" position="before">
<field
name="notify_followers"
attrs="{'invisible': [('composition_mode', '=', 'mass_mail')]}"
invisible="composition_mode == 'mass_mail'"
/>
</xpath>
<xpath expr="//span[@name='document_followers_text']" position="after">
<span
name="no_followers_text"
attrs="{'invisible': [('notify_followers', '=', True)]}"
invisible="notify_followers"
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>
</xpath>