fixes a corner case where you could send an email to a partner
that you are not supposed to.
This commit is contained in:
parent
b8bd728bcb
commit
9c3576e1df
@ -1,6 +1,6 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * mail_restrict_follower_selection
|
||||
# * mail_restrict_follower_selection
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
@ -26,6 +26,11 @@ msgstr "Beschränkung der Abonnenten konfigurieren"
|
||||
msgid "Document Followers"
|
||||
msgstr "Abonnenten des Dokuments"
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_thread
|
||||
msgid "Email Thread"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_wizard_invite
|
||||
msgid "Invite wizard"
|
||||
|
@ -28,6 +28,11 @@ msgstr "Configure the restriction on followers"
|
||||
msgid "Document Followers"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_thread
|
||||
msgid "Email Thread"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_wizard_invite
|
||||
msgid "Invite wizard"
|
||||
|
@ -29,6 +29,11 @@ msgstr "Configurer les restrictions sur les abonnés"
|
||||
msgid "Document Followers"
|
||||
msgstr "Suiveurs du document"
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_thread
|
||||
msgid "Email Thread"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_wizard_invite
|
||||
msgid "Invite wizard"
|
||||
|
@ -29,6 +29,11 @@ msgstr "Postavi ograničenja na pratitelje"
|
||||
msgid "Document Followers"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_thread
|
||||
msgid "Email Thread"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_wizard_invite
|
||||
msgid "Invite wizard"
|
||||
|
@ -28,6 +28,11 @@ msgstr "Imposta restrizioni sui follower"
|
||||
msgid "Document Followers"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_thread
|
||||
msgid "Email Thread"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_wizard_invite
|
||||
msgid "Invite wizard"
|
||||
|
@ -23,6 +23,11 @@ msgstr ""
|
||||
msgid "Document Followers"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_thread
|
||||
msgid "Email Thread"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_wizard_invite
|
||||
msgid "Invite wizard"
|
||||
|
@ -30,6 +30,11 @@ msgstr "Nastavitev omejitev za sledilce"
|
||||
msgid "Document Followers"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_thread
|
||||
msgid "Email Thread"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail_restrict_follower_selection
|
||||
#: model:ir.model,name:mail_restrict_follower_selection.model_mail_wizard_invite
|
||||
msgid "Invite wizard"
|
||||
|
@ -4,3 +4,4 @@
|
||||
|
||||
from . import mail_followers
|
||||
from . import mail_wizard_invite
|
||||
from . import mail_thread
|
||||
|
25
mail_restrict_follower_selection/models/mail_thread.py
Normal file
25
mail_restrict_follower_selection/models/mail_thread.py
Normal file
@ -0,0 +1,25 @@
|
||||
from odoo import api, models
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
|
||||
|
||||
class MailThread(models.AbstractModel):
|
||||
_inherit = 'mail.thread'
|
||||
|
||||
@api.multi
|
||||
def _message_add_suggested_recipient(
|
||||
self, result, partner=None, email=None, reason=''):
|
||||
result = super(MailThread, self)._message_add_suggested_recipient(
|
||||
result, partner=partner, email=email, reason=reason)
|
||||
domain = self.env[
|
||||
'mail.wizard.invite'
|
||||
]._mail_restrict_follower_selection_get_domain()
|
||||
eval_domain = safe_eval(domain)
|
||||
for key in result:
|
||||
for partner_id, email, reason in result[key]:
|
||||
if partner_id:
|
||||
partner = self.env['res.partner'].search(
|
||||
[('id', '=', partner_id)] + eval_domain
|
||||
)
|
||||
if not partner:
|
||||
result[key].remove((partner_id, email, reason))
|
||||
return result
|
Loading…
x
Reference in New Issue
Block a user