[IMP] mail_optional_follower_notification: default notify followers

Add a settings to set a default for the boolean 'Notifiy Followers' in the wizard
pull/1584/head
Quan Nguyen 2023-07-18 11:30:54 +07:00 committed by sygel
parent 318804e296
commit ddf3be8e7a
11 changed files with 50 additions and 2 deletions

View File

@ -49,8 +49,11 @@ This field it's initialized to true to keep the standard behavior.
|image2|
|image3|
.. |image1| image:: https://raw.githubusercontent.com/OCA/social/17.0/mail_optional_follower_notification/static/description/optional_follower_001.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/social/17.0/mail_optional_follower_notification/static/description/optional_follower_002.png
.. |image3| image:: https://raw.githubusercontent.com/OCA/social/17.0/mail_optional_follower_notification/static/description/optional_follower_003.png
Bug Tracker
===========
@ -77,6 +80,7 @@ Contributors
- Laurent Mignon <laurent.mignon@acsone.eu>
- Andrea Stirpe <a.stirpe@onestein.nl>
- Robin Goots <robin.goots@dynapps.be>
- Quan Nguyen quan.nhm@komit-consulting.com
Maintainers
-----------

View File

@ -9,5 +9,8 @@
"version": "17.0.1.0.0",
"license": "AGPL-3",
"depends": ["mail"],
"data": ["wizard/mail_compose_message_view.xml"],
"data": [
"views/res_config_settings_view.xml",
"wizard/mail_compose_message_view.xml",
],
}

View File

@ -1 +1,3 @@
from . import mail_thread
from . import res_company
from . import res_config_settings

View File

@ -0,0 +1,7 @@
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
notify_followers = fields.Boolean(default=True)

View File

@ -0,0 +1,10 @@
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
notify_followers = fields.Boolean(
related="company_id.notify_followers",
readonly=False,
)

View File

@ -2,3 +2,4 @@
- Laurent Mignon \<<laurent.mignon@acsone.eu>\>
- Andrea Stirpe \<<a.stirpe@onestein.nl>\>
- Robin Goots \<<robin.goots@dynapps.be>\>
- Quan Nguyen <quan.nhm@komit-consulting.com>

View File

@ -6,3 +6,5 @@ This field it's initialized to true to keep the standard behavior.
![](static/description/optional_follower_001.png)
![](static/description/optional_follower_002.png)
![](static/description/optional_follower_003.png)

View File

@ -393,6 +393,7 @@ document and” on mail.compose.message:</p>
<p>This field its initialized to true to keep the standard behavior.</p>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/social/17.0/mail_optional_follower_notification/static/description/optional_follower_001.png" /></p>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/social/17.0/mail_optional_follower_notification/static/description/optional_follower_002.png" /></p>
<p><img alt="image3" src="https://raw.githubusercontent.com/OCA/social/17.0/mail_optional_follower_notification/static/description/optional_follower_003.png" /></p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
@ -417,6 +418,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li>
<li>Andrea Stirpe &lt;<a class="reference external" href="mailto:a.stirpe&#64;onestein.nl">a.stirpe&#64;onestein.nl</a>&gt;</li>
<li>Robin Goots &lt;<a class="reference external" href="mailto:robin.goots&#64;dynapps.be">robin.goots&#64;dynapps.be</a>&gt;</li>
<li>Quan Nguyen <a class="reference external" href="mailto:quan.nhm&#64;komit-consulting.com">quan.nhm&#64;komit-consulting.com</a></li>
</ul>
</div>
<div class="section" id="maintainers">

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -0,0 +1,15 @@
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.mail</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="100" />
<field name="inherit_id" ref="mail.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//block[@id='emails']" position="inside">
<setting help="Default notify followers when the user sending email">
<field name="notify_followers" />
</setting>
</xpath>
</field>
</record>
</odoo>

View File

@ -7,7 +7,9 @@ from odoo import fields, models
class MailComposeMessage(models.TransientModel):
_inherit = "mail.compose.message"
notify_followers = fields.Boolean(default=True)
notify_followers = fields.Boolean(
default=lambda self: self.env.company.notify_followers
)
def _action_send_mail(self, auto_commit=False):
result_mails_su, result_messages = (