diff --git a/mail_optional_follower_notification/README.rst b/mail_optional_follower_notification/README.rst index 1ac942ff0..e409bcc86 100644 --- a/mail_optional_follower_notification/README.rst +++ b/mail_optional_follower_notification/README.rst @@ -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 - Andrea Stirpe - Robin Goots +- Quan Nguyen quan.nhm@komit-consulting.com Maintainers ----------- diff --git a/mail_optional_follower_notification/__manifest__.py b/mail_optional_follower_notification/__manifest__.py index 3e20a08e5..e9e27210e 100644 --- a/mail_optional_follower_notification/__manifest__.py +++ b/mail_optional_follower_notification/__manifest__.py @@ -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", + ], } diff --git a/mail_optional_follower_notification/models/__init__.py b/mail_optional_follower_notification/models/__init__.py index b70a9f2d0..f624e45b4 100644 --- a/mail_optional_follower_notification/models/__init__.py +++ b/mail_optional_follower_notification/models/__init__.py @@ -1 +1,3 @@ from . import mail_thread +from . import res_company +from . import res_config_settings diff --git a/mail_optional_follower_notification/models/res_company.py b/mail_optional_follower_notification/models/res_company.py new file mode 100644 index 000000000..65d16edb2 --- /dev/null +++ b/mail_optional_follower_notification/models/res_company.py @@ -0,0 +1,7 @@ +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + notify_followers = fields.Boolean(default=True) diff --git a/mail_optional_follower_notification/models/res_config_settings.py b/mail_optional_follower_notification/models/res_config_settings.py new file mode 100644 index 000000000..b10838299 --- /dev/null +++ b/mail_optional_follower_notification/models/res_config_settings.py @@ -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, + ) diff --git a/mail_optional_follower_notification/readme/CONTRIBUTORS.md b/mail_optional_follower_notification/readme/CONTRIBUTORS.md index b1c80942e..059ec84b6 100644 --- a/mail_optional_follower_notification/readme/CONTRIBUTORS.md +++ b/mail_optional_follower_notification/readme/CONTRIBUTORS.md @@ -2,3 +2,4 @@ - Laurent Mignon \<\> - Andrea Stirpe \<\> - Robin Goots \<\> +- Quan Nguyen diff --git a/mail_optional_follower_notification/readme/USAGE.md b/mail_optional_follower_notification/readme/USAGE.md index 5ed4b61c4..032a19fb3 100644 --- a/mail_optional_follower_notification/readme/USAGE.md +++ b/mail_optional_follower_notification/readme/USAGE.md @@ -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) diff --git a/mail_optional_follower_notification/static/description/index.html b/mail_optional_follower_notification/static/description/index.html index 104f87aff..d9d5136ec 100644 --- a/mail_optional_follower_notification/static/description/index.html +++ b/mail_optional_follower_notification/static/description/index.html @@ -393,6 +393,7 @@ document and” on mail.compose.message:

This field it’s initialized to true to keep the standard behavior.

image1

image2

+

image3

Bug Tracker

@@ -417,6 +418,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
  • 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
  • diff --git a/mail_optional_follower_notification/static/description/optional_follower_003.png b/mail_optional_follower_notification/static/description/optional_follower_003.png new file mode 100644 index 000000000..c300f2789 Binary files /dev/null and b/mail_optional_follower_notification/static/description/optional_follower_003.png differ diff --git a/mail_optional_follower_notification/views/res_config_settings_view.xml b/mail_optional_follower_notification/views/res_config_settings_view.xml new file mode 100644 index 000000000..a2a1d42ce --- /dev/null +++ b/mail_optional_follower_notification/views/res_config_settings_view.xml @@ -0,0 +1,15 @@ + + + res.config.settings.view.form.inherit.mail + res.config.settings + + + + + + + + + + + diff --git a/mail_optional_follower_notification/wizard/mail_compose_message.py b/mail_optional_follower_notification/wizard/mail_compose_message.py index 0cd83ec37..6ee12acd8 100644 --- a/mail_optional_follower_notification/wizard/mail_compose_message.py +++ b/mail_optional_follower_notification/wizard/mail_compose_message.py @@ -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 = (