diff --git a/mail_restrict_follower_selection/i18n/de.po b/mail_restrict_follower_selection/i18n/de.po index 1495d7c..eff2226 100644 --- a/mail_restrict_follower_selection/i18n/de.po +++ b/mail_restrict_follower_selection/i18n/de.po @@ -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" diff --git a/mail_restrict_follower_selection/i18n/en.po b/mail_restrict_follower_selection/i18n/en.po index b6c0235..e03abf3 100644 --- a/mail_restrict_follower_selection/i18n/en.po +++ b/mail_restrict_follower_selection/i18n/en.po @@ -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" diff --git a/mail_restrict_follower_selection/i18n/fr.po b/mail_restrict_follower_selection/i18n/fr.po index e37d276..7f96c92 100644 --- a/mail_restrict_follower_selection/i18n/fr.po +++ b/mail_restrict_follower_selection/i18n/fr.po @@ -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" diff --git a/mail_restrict_follower_selection/i18n/hr.po b/mail_restrict_follower_selection/i18n/hr.po index 4d7bc08..38a74e1 100644 --- a/mail_restrict_follower_selection/i18n/hr.po +++ b/mail_restrict_follower_selection/i18n/hr.po @@ -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" diff --git a/mail_restrict_follower_selection/i18n/it.po b/mail_restrict_follower_selection/i18n/it.po index 10a71b6..54ec814 100644 --- a/mail_restrict_follower_selection/i18n/it.po +++ b/mail_restrict_follower_selection/i18n/it.po @@ -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" diff --git a/mail_restrict_follower_selection/i18n/mail_restrict_follower_selection.pot b/mail_restrict_follower_selection/i18n/mail_restrict_follower_selection.pot index 6bcf2f7..8a87100 100644 --- a/mail_restrict_follower_selection/i18n/mail_restrict_follower_selection.pot +++ b/mail_restrict_follower_selection/i18n/mail_restrict_follower_selection.pot @@ -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" diff --git a/mail_restrict_follower_selection/i18n/sl.po b/mail_restrict_follower_selection/i18n/sl.po index d64d0ba..b350b02 100644 --- a/mail_restrict_follower_selection/i18n/sl.po +++ b/mail_restrict_follower_selection/i18n/sl.po @@ -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" diff --git a/mail_restrict_follower_selection/models/__init__.py b/mail_restrict_follower_selection/models/__init__.py index a757c6b..d6a528c 100644 --- a/mail_restrict_follower_selection/models/__init__.py +++ b/mail_restrict_follower_selection/models/__init__.py @@ -4,3 +4,4 @@ from . import mail_followers from . import mail_wizard_invite +from . import mail_thread diff --git a/mail_restrict_follower_selection/models/mail_thread.py b/mail_restrict_follower_selection/models/mail_thread.py new file mode 100644 index 0000000..c22dd3d --- /dev/null +++ b/mail_restrict_follower_selection/models/mail_thread.py @@ -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