mirror of https://github.com/OCA/social.git
[IMP] mail_show_follower: Add an option to exclude specific models from the CC note.
parent
c5c06ccef7
commit
91be802fee
|
@ -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/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/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 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
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"depends": ["base", "mail"],
|
"depends": ["base", "mail"],
|
||||||
"maintainers": ["yajo"],
|
"maintainers": ["yajo"],
|
||||||
"data": [
|
"data": [
|
||||||
|
"data/config_parameter_data.xml",
|
||||||
"views/res_config_settings.xml",
|
"views/res_config_settings.xml",
|
||||||
"views/res_users.xml",
|
"views/res_users.xml",
|
||||||
],
|
],
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo noupdate="1">
|
||||||
|
<record id="models_to_exclude_config_parameter" model="ir.config_parameter">
|
||||||
|
<field name="key">show_followers.models_to_exclude</field>
|
||||||
|
<field name="value">blog.blog,blog.post</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
|
@ -60,10 +60,16 @@ class MailMail(models.Model):
|
||||||
|
|
||||||
def _send(self, auto_commit=False, raise_exception=False, smtp_session=None):
|
def _send(self, auto_commit=False, raise_exception=False, smtp_session=None):
|
||||||
group_user = self.env.ref("base.group_user")
|
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:
|
for mail in self:
|
||||||
if not (mail.model and mail.res_id and group_user):
|
if not (mail.model and mail.res_id and group_user):
|
||||||
continue
|
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 from any Notification Type (i.e. email, inbox, etc.)
|
||||||
recipients = mail.notification_ids.res_partner_id
|
recipients = mail.notification_ids.res_partner_id
|
||||||
record = self.env[mail.model].browse(mail.res_id)
|
record = self.env[mail.model].browse(mail.res_id)
|
||||||
|
|
|
@ -29,6 +29,10 @@ class ResConfigSettings(models.TransientModel):
|
||||||
readonly=True,
|
readonly=True,
|
||||||
store=False,
|
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(
|
@api.onchange(
|
||||||
"show_followers_message_sent_to",
|
"show_followers_message_sent_to",
|
||||||
|
|
|
@ -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/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/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 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.
|
||||||
|
|
|
@ -399,6 +399,7 @@ In the cc, only appear when:</p>
|
||||||
<li>Go General settings/Discuss/Show Followers on mails/Text ‘Sent to’ and set the initial part of the message.</li>
|
<li>Go General settings/Discuss/Show Followers on mails/Text ‘Sent to’ and set the initial part of the message.</li>
|
||||||
<li>Go General settings/Discuss/Show Followers on mails/Partner format and choose desired fields to show on CC recipients.</li>
|
<li>Go General settings/Discuss/Show Followers on mails/Partner format and choose desired fields to show on CC recipients.</li>
|
||||||
<li>Go General settings/Discuss/Show Followers on mails/Text ‘Replies’ and choose desired warn message</li>
|
<li>Go General settings/Discuss/Show Followers on mails/Text ‘Replies’ and choose desired warn message</li>
|
||||||
|
<li>Go General settings/Discuss/Show Followers in ‘Models to exclude’ enter the models you want to exclude from the CC note.</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="usage">
|
<div class="section" id="usage">
|
||||||
|
|
|
@ -62,6 +62,19 @@
|
||||||
style="display:inline-block;"
|
style="display:inline-block;"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="show_followers_models_to_exclude"
|
||||||
|
string="Models to exclude"
|
||||||
|
class="o_light_label"
|
||||||
|
style="vertical-align: top;"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="show_followers_models_to_exclude"
|
||||||
|
placeholder="blog.blog,blog.post"
|
||||||
|
style="display:inline-block;"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label
|
<label
|
||||||
for="show_followers_message_preview"
|
for="show_followers_message_preview"
|
||||||
|
|
Loading…
Reference in New Issue