diff --git a/mail_restrict_follower_selection/__manifest__.py b/mail_restrict_follower_selection/__manifest__.py index 1a53532..2fed8a5 100644 --- a/mail_restrict_follower_selection/__manifest__.py +++ b/mail_restrict_follower_selection/__manifest__.py @@ -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", diff --git a/mail_restrict_follower_selection/data/ir_actions.xml b/mail_restrict_follower_selection/data/ir_actions.xml index c41dbab..59478e1 100644 --- a/mail_restrict_follower_selection/data/ir_actions.xml +++ b/mail_restrict_follower_selection/data/ir_actions.xml @@ -1,13 +1,10 @@ - - + + Configure the restriction on followers + ir.config_parameter + form Configure the restriction on followers diff --git a/mail_restrict_follower_selection/models/mail_followers.py b/mail_restrict_follower_selection/models/mail_followers.py index a19a27e..06a9aaa 100644 --- a/mail_restrict_follower_selection/models/mail_followers.py +++ b/mail_restrict_follower_selection/models/mail_followers.py @@ -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() diff --git a/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py b/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py index c4ce705..9806569 100644 --- a/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py +++ b/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py @@ -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})