[MIG] mail_restrict_follower_selection: Migration to 14.0
This commit is contained in:
parent
3d34c5ac89
commit
3316ab142a
@ -4,7 +4,7 @@
|
||||
|
||||
{
|
||||
"name": "Restrict follower selection",
|
||||
"version": "13.0.1.0.2",
|
||||
"version": "14.0.1.0.0",
|
||||
"author": "Therp BV,Creu Blanca,Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"category": "Social Network",
|
||||
|
@ -1,13 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<act_window
|
||||
id="action_setup"
|
||||
res_model="ir.config_parameter"
|
||||
name="Configure the restriction on followers"
|
||||
view_mode="form"
|
||||
/>
|
||||
<record id="action_setup" model="ir.actions.act_window">
|
||||
<record model="ir.actions.act_window" id="action_setup">
|
||||
<field name="name">Configure the restriction on followers</field>
|
||||
<field name="res_model">ir.config_parameter</field>
|
||||
<field name="res_id" ref="parameter_domain" />
|
||||
<field name="view_mode">form</field>
|
||||
</record>
|
||||
<record id="todo_setup" model="ir.actions.todo">
|
||||
<field name="name">Configure the restriction on followers</field>
|
||||
|
@ -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
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
|
||||
|
||||
@ -19,6 +20,20 @@ class MailFollowers(models.Model):
|
||||
check_existing=False,
|
||||
existing_policy="skip",
|
||||
):
|
||||
test_condition = config["test_enable"] and not self.env.context.get(
|
||||
"test_restrict_follower"
|
||||
)
|
||||
if test_condition or self.env.context.get("no_restrict_follower"):
|
||||
return super()._add_followers(
|
||||
res_model,
|
||||
res_ids,
|
||||
partner_ids,
|
||||
partner_subtypes,
|
||||
channel_ids,
|
||||
channel_subtypes,
|
||||
check_existing=check_existing,
|
||||
existing_policy=existing_policy,
|
||||
)
|
||||
domain = self.env[
|
||||
"mail.wizard.invite"
|
||||
]._mail_restrict_follower_selection_get_domain()
|
||||
|
@ -33,12 +33,11 @@ class TestMailRestrictFollowerSelection(TransactionCase):
|
||||
compose = (
|
||||
self.env["mail.compose.message"]
|
||||
.with_context(
|
||||
{
|
||||
"mail_post_autofollow": True,
|
||||
"default_composition_mode": "comment",
|
||||
"default_model": "res.partner",
|
||||
"default_use_active_domain": True,
|
||||
}
|
||||
mail_post_autofollow=True,
|
||||
default_composition_mode="comment",
|
||||
default_model="res.partner",
|
||||
default_use_active_domain=True,
|
||||
test_restrict_follower=True,
|
||||
)
|
||||
.create(
|
||||
{
|
||||
@ -50,7 +49,7 @@ class TestMailRestrictFollowerSelection(TransactionCase):
|
||||
)
|
||||
)
|
||||
self.assertEqual(compose.partner_ids, self.partner)
|
||||
compose.action_send_mail()
|
||||
compose.send_mail()
|
||||
|
||||
def test_followers_meet(self):
|
||||
self.partner.write({"category_id": self.category_employees})
|
||||
|
Loading…
Reference in New Issue
Block a user