diff --git a/mail_show_follower/README.rst b/mail_show_follower/README.rst index e356a3ac59..27f4d201a0 100644 --- a/mail_show_follower/README.rst +++ b/mail_show_follower/README.rst @@ -49,6 +49,7 @@ To configure this module, you need to: #. Go General settings/Discuss/Show Followers on mails/Text 'Sent to' and set the initial part of the message. #. Go General settings/Discuss/Show Followers on mails/Partner format and choose desired fields to show on CC recipients. #. Go General settings/Discuss/Show Followers on mails/Text 'Replies' and choose desired warn message +#. Go General settings/Discuss/Show Followers in 'Models to exclude' enter the models you want to exclude from the CC note. Usage ===== diff --git a/mail_show_follower/__manifest__.py b/mail_show_follower/__manifest__.py index 0c1cfb9032..712fb2c749 100644 --- a/mail_show_follower/__manifest__.py +++ b/mail_show_follower/__manifest__.py @@ -15,6 +15,7 @@ "depends": ["base", "mail"], "maintainers": ["yajo"], "data": [ + "data/config_parameter_data.xml", "views/res_config_settings.xml", "views/res_users.xml", ], diff --git a/mail_show_follower/data/config_parameter_data.xml b/mail_show_follower/data/config_parameter_data.xml new file mode 100644 index 0000000000..0c65311403 --- /dev/null +++ b/mail_show_follower/data/config_parameter_data.xml @@ -0,0 +1,7 @@ + + + + show_followers.models_to_exclude + blog.blog,blog.post + + diff --git a/mail_show_follower/models/mail_mail.py b/mail_show_follower/models/mail_mail.py index 3d3ce56391..ed783b44e4 100644 --- a/mail_show_follower/models/mail_mail.py +++ b/mail_show_follower/models/mail_mail.py @@ -60,10 +60,16 @@ def remove_p(markup_txt): def _send(self, auto_commit=False, raise_exception=False, smtp_session=None): group_user = self.env.ref("base.group_user") - + models_to_exclude = ( + self.env["ir.config_parameter"] + .sudo() + .get_param("show_followers.models_to_exclude", "") + ) for mail in self: if not (mail.model and mail.res_id and group_user): continue + if models_to_exclude and mail.model in models_to_exclude.split(","): + continue # recipients from any Notification Type (i.e. email, inbox, etc.) recipients = mail.notification_ids.res_partner_id record = self.env[mail.model].browse(mail.res_id) diff --git a/mail_show_follower/models/res_config_settings.py b/mail_show_follower/models/res_config_settings.py index 43c92ed5ae..8c50849a3a 100644 --- a/mail_show_follower/models/res_config_settings.py +++ b/mail_show_follower/models/res_config_settings.py @@ -29,6 +29,10 @@ class ResConfigSettings(models.TransientModel): readonly=True, store=False, ) + show_followers_models_to_exclude = fields.Char( + help="Tecnichal model names separated by coma", + config_parameter="show_followers.models_to_exclude", + ) @api.onchange( "show_followers_message_sent_to", diff --git a/mail_show_follower/readme/CONFIGURE.rst b/mail_show_follower/readme/CONFIGURE.rst index 5085e47139..291ccb962b 100644 --- a/mail_show_follower/readme/CONFIGURE.rst +++ b/mail_show_follower/readme/CONFIGURE.rst @@ -5,3 +5,4 @@ To configure this module, you need to: #. Go General settings/Discuss/Show Followers on mails/Text 'Sent to' and set the initial part of the message. #. Go General settings/Discuss/Show Followers on mails/Partner format and choose desired fields to show on CC recipients. #. Go General settings/Discuss/Show Followers on mails/Text 'Replies' and choose desired warn message +#. Go General settings/Discuss/Show Followers in 'Models to exclude' enter the models you want to exclude from the CC note. diff --git a/mail_show_follower/static/description/index.html b/mail_show_follower/static/description/index.html index 1742e147ef..2f72ef996b 100644 --- a/mail_show_follower/static/description/index.html +++ b/mail_show_follower/static/description/index.html @@ -399,6 +399,7 @@

Configuration

  • Go General settings/Discuss/Show Followers on mails/Text ‘Sent to’ and set the initial part of the message.
  • Go General settings/Discuss/Show Followers on mails/Partner format and choose desired fields to show on CC recipients.
  • Go General settings/Discuss/Show Followers on mails/Text ‘Replies’ and choose desired warn message
  • +
  • Go General settings/Discuss/Show Followers in ‘Models to exclude’ enter the models you want to exclude from the CC note.
  • diff --git a/mail_show_follower/views/res_config_settings.xml b/mail_show_follower/views/res_config_settings.xml index 922bd77f8c..d223106eba 100644 --- a/mail_show_follower/views/res_config_settings.xml +++ b/mail_show_follower/views/res_config_settings.xml @@ -62,6 +62,19 @@ style="display:inline-block;" />
    +
    +