diff --git a/mail_optional_follower_notification/README.rst b/mail_optional_follower_notification/README.rst new file mode 100644 index 00000000..0998cc9d --- /dev/null +++ b/mail_optional_follower_notification/README.rst @@ -0,0 +1,60 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +==================================== +Mail optional follower notifications +==================================== + +This module adds the possibility to choose if you want to automatically +notify followers on mail.compose.message. By default, Odoo notify +automatically all followers. + +Usage +===== + +To use this module, you need to use the checkbox near "Followers of the document and" on mail.compose.message: + +This field it's initialized to true to keep the standard behavior. + +.. figure:: static/description/optional_follower_001.png + :alt: Default checkbox + +.. figure:: static/description/optional_follower_002.png + :alt: Checkbox to avoid to notify automatically followers + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/205/10.0 + + * https://www.odoo.com/forum/help-1 + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Adrien Peiffer +* Laurent Mignon + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/mail_optional_follower_notification/__init__.py b/mail_optional_follower_notification/__init__.py new file mode 100644 index 00000000..98aa84d4 --- /dev/null +++ b/mail_optional_follower_notification/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models +from . import wizard diff --git a/mail_optional_follower_notification/__manifest__.py b/mail_optional_follower_notification/__manifest__.py new file mode 100644 index 00000000..848dc736 --- /dev/null +++ b/mail_optional_follower_notification/__manifest__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + 'name': "Mail optional follower notification", + + 'summary': """ + Choose if you want to automatically notify followers + on mail.compose.message""", + 'author': 'ACSONE SA/NV,' + 'Odoo Community Association (OCA)', + 'website': "http://acsone.eu", + 'category': 'Social Network', + 'version': '10.0.1.0.0', + 'license': 'AGPL-3', + 'depends': [ + 'mail', + ], + 'data': [ + 'wizard/mail_compose_message_view.xml', + ], +} diff --git a/mail_optional_follower_notification/i18n/ca.po b/mail_optional_follower_notification/i18n/ca.po new file mode 100644 index 00000000..2889abda --- /dev/null +++ b/mail_optional_follower_notification/i18n/ca.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_follower_notification +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-05-26 02:42+0000\n" +"PO-Revision-Date: 2016-05-25 14:10+0000\n" +"Last-Translator: <>\n" +"Language-Team: Catalan (http://www.transifex.com/oca/OCA-social-8-0/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_optional_follower_notification +#: view:mail.compose.message:mail_optional_follower_notification.email_compose_message_wizard_inherit_form +msgid "" +"- Warning : Followers will not be notified but they can access the " +"notification directly from the document (if they are allowed to)" +msgstr "" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistent per composició de correus electrònics" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_message +msgid "Message" +msgstr "Missatge" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_notification +msgid "Notifications" +msgstr "" + +#. module: mail_optional_follower_notification +#: field:mail.compose.message,notify_followers:0 +msgid "Notify followers" +msgstr "" diff --git a/mail_optional_follower_notification/i18n/de.po b/mail_optional_follower_notification/i18n/de.po new file mode 100644 index 00000000..460d58dd --- /dev/null +++ b/mail_optional_follower_notification/i18n/de.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_follower_notification +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-05-26 02:42+0000\n" +"PO-Revision-Date: 2016-05-25 14:10+0000\n" +"Last-Translator: <>\n" +"Language-Team: German (http://www.transifex.com/oca/OCA-social-8-0/language/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_optional_follower_notification +#: view:mail.compose.message:mail_optional_follower_notification.email_compose_message_wizard_inherit_form +msgid "" +"- Warning : Followers will not be notified but they can access the " +"notification directly from the document (if they are allowed to)" +msgstr "" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistent zum Email verfassen" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_message +msgid "Message" +msgstr "Nachricht" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_notification +msgid "Notifications" +msgstr "" + +#. module: mail_optional_follower_notification +#: field:mail.compose.message,notify_followers:0 +msgid "Notify followers" +msgstr "" diff --git a/mail_optional_follower_notification/i18n/en.po b/mail_optional_follower_notification/i18n/en.po new file mode 100644 index 00000000..31d8f26a --- /dev/null +++ b/mail_optional_follower_notification/i18n/en.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_follower_notification +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-05-26 02:42+0000\n" +"PO-Revision-Date: 2016-05-25 14:10+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: English (http://www.transifex.com/oca/OCA-social-8-0/language/en/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_optional_follower_notification +#: view:mail.compose.message:mail_optional_follower_notification.email_compose_message_wizard_inherit_form +msgid "" +"- Warning : Followers will not be notified but they can access the " +"notification directly from the document (if they are allowed to)" +msgstr "- Warning : Followers will not be notified but they can access the notification directly from the document (if they are allowed to)" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Email composition wizard" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_message +msgid "Message" +msgstr "Message" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_notification +msgid "Notifications" +msgstr "Notifications" + +#. module: mail_optional_follower_notification +#: field:mail.compose.message,notify_followers:0 +msgid "Notify followers" +msgstr "Notify followers" diff --git a/mail_optional_follower_notification/i18n/es.po b/mail_optional_follower_notification/i18n/es.po new file mode 100644 index 00000000..122a99fc --- /dev/null +++ b/mail_optional_follower_notification/i18n/es.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_follower_notification +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-05-26 02:42+0000\n" +"PO-Revision-Date: 2016-05-25 14:10+0000\n" +"Last-Translator: <>\n" +"Language-Team: Spanish (http://www.transifex.com/oca/OCA-social-8-0/language/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_optional_follower_notification +#: view:mail.compose.message:mail_optional_follower_notification.email_compose_message_wizard_inherit_form +msgid "" +"- Warning : Followers will not be notified but they can access the " +"notification directly from the document (if they are allowed to)" +msgstr "" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Asistente composición Correo Electrónico" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_message +msgid "Message" +msgstr "Mensaje" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_notification +msgid "Notifications" +msgstr "Notificaciones" + +#. module: mail_optional_follower_notification +#: field:mail.compose.message,notify_followers:0 +msgid "Notify followers" +msgstr "" diff --git a/mail_optional_follower_notification/i18n/es_CO.po b/mail_optional_follower_notification/i18n/es_CO.po new file mode 100644 index 00000000..5d3380a9 --- /dev/null +++ b/mail_optional_follower_notification/i18n/es_CO.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_follower_notification +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-05-26 02:42+0000\n" +"PO-Revision-Date: 2016-05-25 14:10+0000\n" +"Last-Translator: <>\n" +"Language-Team: Spanish (Colombia) (http://www.transifex.com/oca/OCA-social-8-0/language/es_CO/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es_CO\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_optional_follower_notification +#: view:mail.compose.message:mail_optional_follower_notification.email_compose_message_wizard_inherit_form +msgid "" +"- Warning : Followers will not be notified but they can access the " +"notification directly from the document (if they are allowed to)" +msgstr "" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Asistente de redacción de E-mail" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_message +msgid "Message" +msgstr "Mensaje" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_notification +msgid "Notifications" +msgstr "" + +#. module: mail_optional_follower_notification +#: field:mail.compose.message,notify_followers:0 +msgid "Notify followers" +msgstr "" diff --git a/mail_optional_follower_notification/i18n/pt_BR.po b/mail_optional_follower_notification/i18n/pt_BR.po new file mode 100644 index 00000000..2321d5ed --- /dev/null +++ b/mail_optional_follower_notification/i18n/pt_BR.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_follower_notification +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-05-26 02:42+0000\n" +"PO-Revision-Date: 2016-05-25 14:10+0000\n" +"Last-Translator: <>\n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-social-8-0/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: mail_optional_follower_notification +#: view:mail.compose.message:mail_optional_follower_notification.email_compose_message_wizard_inherit_form +msgid "" +"- Warning : Followers will not be notified but they can access the " +"notification directly from the document (if they are allowed to)" +msgstr "" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistente de Composição de Email" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_message +msgid "Message" +msgstr "Mensagem" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_notification +msgid "Notifications" +msgstr "" + +#. module: mail_optional_follower_notification +#: field:mail.compose.message,notify_followers:0 +msgid "Notify followers" +msgstr "" diff --git a/mail_optional_follower_notification/i18n/sl.po b/mail_optional_follower_notification/i18n/sl.po new file mode 100644 index 00000000..6942575c --- /dev/null +++ b/mail_optional_follower_notification/i18n/sl.po @@ -0,0 +1,46 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_follower_notification +# +# Translators: +# Matjaž Mozetič , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-05-26 02:42+0000\n" +"PO-Revision-Date: 2016-05-26 04:13+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-social-8-0/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: mail_optional_follower_notification +#: view:mail.compose.message:mail_optional_follower_notification.email_compose_message_wizard_inherit_form +msgid "" +"- Warning : Followers will not be notified but they can access the " +"notification directly from the document (if they are allowed to)" +msgstr "- Pozor : Sledilci ne bodo obveščeni, lahko pa neposredno dostopajo do obvestila v dokumentu (če za to imajo pravice)" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Čarovnik za sestavljanje e-pošte" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_message +msgid "Message" +msgstr "Sporočilo" + +#. module: mail_optional_follower_notification +#: model:ir.model,name:mail_optional_follower_notification.model_mail_notification +msgid "Notifications" +msgstr "Obvestila" + +#. module: mail_optional_follower_notification +#: field:mail.compose.message,notify_followers:0 +msgid "Notify followers" +msgstr "Obvesti sledilce" diff --git a/mail_optional_follower_notification/models/__init__.py b/mail_optional_follower_notification/models/__init__.py new file mode 100644 index 00000000..0c4de321 --- /dev/null +++ b/mail_optional_follower_notification/models/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import mail_message +from . import res_partner diff --git a/mail_optional_follower_notification/models/mail_message.py b/mail_optional_follower_notification/models/mail_message.py new file mode 100644 index 00000000..84666b68 --- /dev/null +++ b/mail_optional_follower_notification/models/mail_message.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models, api + + +class MailMessage(models.Model): + _inherit = 'mail.message' + + @api.model + def create(self, values): + ctx = self.env.context.copy() + if not ctx.get('notify_followers') and values.get('partner_ids'): + partner_list = self.resolve_2many_commands( + 'partner_ids', values.get('partner_ids'), fields=['id']) + force_partners_to_notify = [d['id'] for d in partner_list] + ctx['force_partners_to_notify'] = force_partners_to_notify + return super(MailMessage, self.with_context(ctx)).create(values) + + @api.multi + def _notify(self, force_send=False, send_after_commit=True, + user_signature=True): + res = super(MailMessage, self)._notify( + force_send=force_send, send_after_commit=send_after_commit, + user_signature=user_signature) + if not self.env.context.get('notify_followers'): + # Needaction only for recipients + self.needaction_partner_ids = [(6, 0, self.partner_ids.ids)] + return res diff --git a/mail_optional_follower_notification/models/res_partner.py b/mail_optional_follower_notification/models/res_partner.py new file mode 100644 index 00000000..f32d9bb0 --- /dev/null +++ b/mail_optional_follower_notification/models/res_partner.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models, api + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + @api.multi + def _notify(self, message, force_send=False, send_after_commit=True, + user_signature=True): + if self.env.context.get('force_partners_to_notify'): + partners_to_notify =\ + self.env.context.get('force_partners_to_notify') + self = self.filtered(lambda p: p.id in partners_to_notify) + super(ResPartner, self)._notify( + message, force_send=force_send, + send_after_commit=send_after_commit, user_signature=user_signature) diff --git a/mail_optional_follower_notification/static/description/icon.png b/mail_optional_follower_notification/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/mail_optional_follower_notification/static/description/icon.png differ diff --git a/mail_optional_follower_notification/static/description/optional_follower_001.png b/mail_optional_follower_notification/static/description/optional_follower_001.png new file mode 100644 index 00000000..897e596c Binary files /dev/null and b/mail_optional_follower_notification/static/description/optional_follower_001.png differ diff --git a/mail_optional_follower_notification/static/description/optional_follower_002.png b/mail_optional_follower_notification/static/description/optional_follower_002.png new file mode 100644 index 00000000..24d9d975 Binary files /dev/null and b/mail_optional_follower_notification/static/description/optional_follower_002.png differ diff --git a/mail_optional_follower_notification/tests/__init__.py b/mail_optional_follower_notification/tests/__init__.py new file mode 100644 index 00000000..2a6791af --- /dev/null +++ b/mail_optional_follower_notification/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_mail_optional_follower_notifications diff --git a/mail_optional_follower_notification/tests/test_mail_optional_follower_notifications.py b/mail_optional_follower_notification/tests/test_mail_optional_follower_notifications.py new file mode 100644 index 00000000..67b26aff --- /dev/null +++ b/mail_optional_follower_notification/tests/test_mail_optional_follower_notifications.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests import common + + +class TestMailOptionalFollowernotifications(common.TransactionCase): + + def setUp(self): + super(TestMailOptionalFollowernotifications, self).setUp() + self.partner_obj = self.env['res.partner'] + self.partner_01 = self.env.ref('base.res_partner_2') + self.demo_user = self.env.ref('base.user_demo') + self.partner_03 = self.demo_user.copy().partner_id + + def test_send_email_optional_follower_notifications(self): + ctx = self.env.context.copy() + ctx.update({ + 'default_model': 'res.partner', + 'default_res_id': self.partner_01.id, + 'default_composition_mode': 'comment', + }) + mail_compose = self.env['mail.compose.message'] + self.partner_01.message_subscribe_users(user_ids=[self.demo_user.id]) + values = mail_compose.with_context(ctx)\ + .onchange_template_id(False, 'comment', 'res.partner', + self.partner_01.id)['value'] + values['partner_ids'] = [(4, self.demo_user.partner_id.id), + (4, self.partner_03.id)] + compose_id = mail_compose.with_context(ctx).create(values) + compose_id.with_context(ctx).send_mail() + res = self.env["mail.message"].search( + [('model', '=', 'res.partner'), + ('res_id', '=', self.partner_01.id)]) + self.assertEqual(len(res.ids), 1) + message = self.env['mail.message'] + for record in res: + if record.notification_ids.mapped('res_partner_id').ids == \ + [self.partner_03.id] and \ + record.partner_ids.ids == [self.partner_03.id]: + message += record + self.assertEqual(len(message.ids), 0) + values['partner_ids'] = [(6, 0, [self.partner_03.id])] + compose_id = mail_compose.with_context(ctx).create(values) + compose_id.notify_followers = False + compose_id.with_context(ctx).send_mail() + res = self.env["mail.message"].search( + [('model', '=', 'res.partner'), + ('res_id', '=', self.partner_01.id)]) + message = self.env['mail.message'] + for record in res: + if record.notification_ids.mapped('res_partner_id').ids == \ + [self.partner_03.id] and\ + record.partner_ids.ids == [self.partner_03.id]: + message += record + self.assertEqual(len(message.ids), 1) diff --git a/mail_optional_follower_notification/wizard/__init__.py b/mail_optional_follower_notification/wizard/__init__.py new file mode 100644 index 00000000..56c0250a --- /dev/null +++ b/mail_optional_follower_notification/wizard/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import mail_compose_message diff --git a/mail_optional_follower_notification/wizard/mail_compose_message.py b/mail_optional_follower_notification/wizard/mail_compose_message.py new file mode 100644 index 00000000..d90bb4b7 --- /dev/null +++ b/mail_optional_follower_notification/wizard/mail_compose_message.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models, fields, api + + +class MailComposeMessage(models.TransientModel): + _inherit = 'mail.compose.message' + + notify_followers = fields.Boolean(default=True) + + @api.multi + def send_mail(self, auto_commit=False): + for wizard in self: + wizard = wizard.with_context( + notify_followers=wizard.notify_followers) + super(MailComposeMessage, wizard).send_mail( + auto_commit=auto_commit) + return {'type': 'ir.actions.act_window_close'} diff --git a/mail_optional_follower_notification/wizard/mail_compose_message_view.xml b/mail_optional_follower_notification/wizard/mail_compose_message_view.xml new file mode 100644 index 00000000..b4ba5194 --- /dev/null +++ b/mail_optional_follower_notification/wizard/mail_compose_message_view.xml @@ -0,0 +1,18 @@ + + + + + mail.compose.message.form (mail_optional_autofollow) + mail.compose.message + + + + + + + - Warning : Followers will not be notified but they can access the notification directly from the document (if they are allowed to) + + + + + \ No newline at end of file diff --git a/setup/mail_optional_follower_notification/odoo/__init__.py b/setup/mail_optional_follower_notification/odoo/__init__.py new file mode 100644 index 00000000..de40ea7c --- /dev/null +++ b/setup/mail_optional_follower_notification/odoo/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/mail_optional_follower_notification/odoo/addons/__init__.py b/setup/mail_optional_follower_notification/odoo/addons/__init__.py new file mode 100644 index 00000000..de40ea7c --- /dev/null +++ b/setup/mail_optional_follower_notification/odoo/addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/mail_optional_follower_notification/odoo/addons/mail_optional_follower_notification b/setup/mail_optional_follower_notification/odoo/addons/mail_optional_follower_notification new file mode 120000 index 00000000..95258400 --- /dev/null +++ b/setup/mail_optional_follower_notification/odoo/addons/mail_optional_follower_notification @@ -0,0 +1 @@ +../../../../mail_optional_follower_notification \ No newline at end of file diff --git a/setup/mail_optional_follower_notification/setup.py b/setup/mail_optional_follower_notification/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/mail_optional_follower_notification/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)