[MIG] mail_optional_follower_notification: Migration to 14.0

This commit is contained in:
Ioan Galan 2021-05-07 16:46:45 +02:00 committed by Robin Goots
parent bc85608926
commit c92749d93c
3 changed files with 10 additions and 3 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": "13.0.1.1.0",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"depends": ["mail"],
"data": ["wizard/mail_compose_message_view.xml"],

View File

@ -2,6 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
from odoo.tools import config
class MailThread(models.AbstractModel):
@ -10,7 +11,12 @@ class MailThread(models.AbstractModel):
def _notify_compute_recipients(self, message, msg_vals):
"""Compute recipients to notify based on subtype and followers. This
method returns data structured as expected for ``_notify_recipients``."""
test_condition = config["test_enable"] and not self.env.context.get(
"test_optional_follow_notification"
)
recipient_data = super()._notify_compute_recipients(message, msg_vals)
if test_condition:
return recipient_data
if "notify_followers" in self.env.context and not self.env.context.get(
"notify_followers", False
):

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 import common
from odoo.tests.common import SavepointCase
class TestMailOptionalFollowernotifications(common.SavepointCase):
class TestMailOptionalFollowernotifications(SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
@ -20,6 +20,7 @@ class TestMailOptionalFollowernotifications(common.SavepointCase):
"default_model": "res.partner",
"default_res_id": cls.partner_01.id,
"default_composition_mode": "comment",
"test_optional_follow_notification": True,
}
)
cls.mail_compose_context = ctx