[IMP] mail_restrict_follower_selection: Add condition for tests

This commit is contained in:
Alexandre Díaz 2020-04-15 20:47:58 +02:00 committed by Aungkokolin1997
parent 7a4b1aa462
commit a09f5c8068
2 changed files with 7 additions and 1 deletions

View File

@ -4,7 +4,7 @@
{ {
"name": "Restrict follower selection", "name": "Restrict follower selection",
"version": "13.0.1.0.0", "version": "13.0.1.0.1",
"author": "Therp BV,Creu Blanca,Odoo Community Association (OCA)", "author": "Therp BV,Creu Blanca,Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"category": "Social Network", "category": "Social Network",

View File

@ -1,4 +1,5 @@
from odoo import models from odoo import models
from odoo.tools import config
from odoo.tools.safe_eval import safe_eval from odoo.tools.safe_eval import safe_eval
@ -11,6 +12,11 @@ class MailThread(models.AbstractModel):
result = super(MailThread, self)._message_add_suggested_recipient( result = super(MailThread, self)._message_add_suggested_recipient(
result, partner=partner, email=email, reason=reason result, partner=partner, email=email, reason=reason
) )
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 result
domain = self.env[ domain = self.env[
"mail.wizard.invite" "mail.wizard.invite"
]._mail_restrict_follower_selection_get_domain() ]._mail_restrict_follower_selection_get_domain()