diff --git a/mail_optional_autofollow/README.rst b/mail_optional_autofollow/README.rst new file mode 100644 index 0000000000..32f07fa3ee --- /dev/null +++ b/mail_optional_autofollow/README.rst @@ -0,0 +1,78 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +======================== +Mail optional autofollow +======================== + +This module adds the possibility to choose if you want to automatically +add new recipients as followers on mail.compose.message. + +Installation +============ + + +Configuration +============= + + +Usage +===== + +To use this module, you need to use the autofollow recipients checkbox on +mail.compose.message: + +Technically, this field is initialized to true if there is a +'mail_post_autofollow' key in the current context + +.. figure:: static/description/autofollow.png + :alt: autofollow recipients checkbox + +.. 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/11.0 + +Known issues / Roadmap +====================== + + +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 +`here `_. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Adrien Peiffer +* Stéphane Bidoul + +Do not contact contributors directly about support or help with technical issues. + +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_autofollow/__init__.py b/mail_optional_autofollow/__init__.py new file mode 100644 index 0000000000..40272379f7 --- /dev/null +++ b/mail_optional_autofollow/__init__.py @@ -0,0 +1 @@ +from . import wizard diff --git a/mail_optional_autofollow/__manifest__.py b/mail_optional_autofollow/__manifest__.py new file mode 100644 index 0000000000..74cf2bd30e --- /dev/null +++ b/mail_optional_autofollow/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Mail optional autofollow", + "summary": """ + Choose if you want to automatically add new recipients as followers + on mail.compose.message""", + "author": "ACSONE SA/NV," "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/social", + "category": "Social Network", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "depends": ["mail"], + "data": ["wizard/mail_compose_message_view.xml"], + "installable": True, +} diff --git a/mail_optional_autofollow/i18n/ca.po b/mail_optional_autofollow/i18n/ca.po new file mode 100644 index 0000000000..41a58a0774 --- /dev/null +++ b/mail_optional_autofollow/i18n/ca.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_autofollow +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-04-14 07:09+0000\n" +"PO-Revision-Date: 2016-04-05 07:05+0000\n" +"Last-Translator: <>\n" +"Language-Team: Catalan (http://www.transifex.com/oca/OCA-social-8-0/language/" +"ca/)\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_optional_autofollow +#: model:ir.model,name:mail_optional_autofollow.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistent per composició de correus electrònics" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,field_description:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "Make recipients followers" +msgstr "" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,help:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "" +"if checked, the additional recipients will be added as followers on " +"the related object" +msgstr "" diff --git a/mail_optional_autofollow/i18n/de.po b/mail_optional_autofollow/i18n/de.po new file mode 100644 index 0000000000..45d199bb9d --- /dev/null +++ b/mail_optional_autofollow/i18n/de.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_autofollow +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-04-14 07:09+0000\n" +"PO-Revision-Date: 2018-12-15 14:58+0000\n" +"Last-Translator: Maria Sparenberg \n" +"Language-Team: German (http://www.transifex.com/oca/OCA-social-8-0/language/" +"de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.3\n" + +#. module: mail_optional_autofollow +#: model:ir.model,name:mail_optional_autofollow.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistent zum Email verfassen" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,field_description:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "Make recipients followers" +msgstr "Empfänger als Abonnenten hinzufügen" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,help:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "" +"if checked, the additional recipients will be added as followers on " +"the related object" +msgstr "" +"Wenn der Haken gesetzt ist, werden die zusätzlichen Empfänger zu Abonnenten " +"dieses Objektes" diff --git a/mail_optional_autofollow/i18n/es.po b/mail_optional_autofollow/i18n/es.po new file mode 100644 index 0000000000..08845cc89a --- /dev/null +++ b/mail_optional_autofollow/i18n/es.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_autofollow +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-04-14 07:09+0000\n" +"PO-Revision-Date: 2024-01-09 20:34+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: Spanish (http://www.transifex.com/oca/OCA-social-8-0/language/" +"es/)\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: mail_optional_autofollow +#: model:ir.model,name:mail_optional_autofollow.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Asistente composición Correo Electrónico" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,field_description:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "Make recipients followers" +msgstr "Hacer seguidores a destinatarios" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,help:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "" +"if checked, the additional recipients will be added as followers on " +"the related object" +msgstr "" +"si está marcada, los destinatarios adicionales se añadirán " +"como seguidores en el objeto relacionado" diff --git a/mail_optional_autofollow/i18n/es_CO.po b/mail_optional_autofollow/i18n/es_CO.po new file mode 100644 index 0000000000..fe117459bf --- /dev/null +++ b/mail_optional_autofollow/i18n/es_CO.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_autofollow +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-04-14 07:09+0000\n" +"PO-Revision-Date: 2016-04-05 07:05+0000\n" +"Last-Translator: <>\n" +"Language-Team: Spanish (Colombia) (http://www.transifex.com/oca/OCA-" +"social-8-0/language/es_CO/)\n" +"Language: es_CO\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_optional_autofollow +#: model:ir.model,name:mail_optional_autofollow.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Asistente de redacción de E-mail" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,field_description:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "Make recipients followers" +msgstr "" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,help:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "" +"if checked, the additional recipients will be added as followers on " +"the related object" +msgstr "" diff --git a/mail_optional_autofollow/i18n/fr.po b/mail_optional_autofollow/i18n/fr.po new file mode 100644 index 0000000000..54a32ced1b --- /dev/null +++ b/mail_optional_autofollow/i18n/fr.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_autofollow +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-12 02:44+0000\n" +"PO-Revision-Date: 2016-06-11 22:15+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: French (http://www.transifex.com/oca/OCA-social-9-0/language/" +"fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: mail_optional_autofollow +#: model:ir.model,name:mail_optional_autofollow.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistant de composition de courriel" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,field_description:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "Make recipients followers" +msgstr "Abonner les destinataires" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,help:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "" +"if checked, the additional recipients will be added as followers on " +"the related object" +msgstr "" +"Si coché, les destinataires supplémentaires seront ajoutés comme abonné au " +"file de discussion sur l'objet lié" diff --git a/mail_optional_autofollow/i18n/hr.po b/mail_optional_autofollow/i18n/hr.po new file mode 100644 index 0000000000..c152a6813c --- /dev/null +++ b/mail_optional_autofollow/i18n/hr.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_autofollow +# +# Translators: +# Bole , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-13 02:44+0000\n" +"PO-Revision-Date: 2016-06-14 11:31+0000\n" +"Last-Translator: Bole \n" +"Language-Team: Croatian (http://www.transifex.com/oca/OCA-social-9-0/" +"language/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: mail_optional_autofollow +#: model:ir.model,name:mail_optional_autofollow.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Čarobnjak za sastavljanje maila" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,field_description:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "Make recipients followers" +msgstr "Učini primatelje i pratiteljima" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,help:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "" +"if checked, the additional recipients will be added as followers on " +"the related object" +msgstr "" +"Ukoliko je označeno, dodatni primatelji će biti dodani i kao pratitelji na " +"povezanom objektu" diff --git a/mail_optional_autofollow/i18n/it.po b/mail_optional_autofollow/i18n/it.po new file mode 100644 index 0000000000..83da2cd6a3 --- /dev/null +++ b/mail_optional_autofollow/i18n/it.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_autofollow +# +# Translators: +# Marius Marolla , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-17 01:02+0000\n" +"PO-Revision-Date: 2024-02-05 09:41+0000\n" +"Last-Translator: mymage \n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: mail_optional_autofollow +#: model:ir.model,name:mail_optional_autofollow.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Procedura guidata creazione e-mail" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,field_description:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "Make recipients followers" +msgstr "Destinatari in Follower" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,help:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "" +"if checked, the additional recipients will be added as followers on " +"the related object" +msgstr "" +"Se selezionata, i destinatari aggiuntivi verranno aggiunti a chi " +"segue questo documento" diff --git a/mail_optional_autofollow/i18n/mail_optional_autofollow.pot b/mail_optional_autofollow/i18n/mail_optional_autofollow.pot new file mode 100644 index 0000000000..85f291cdfa --- /dev/null +++ b/mail_optional_autofollow/i18n/mail_optional_autofollow.pot @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_autofollow +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mail_optional_autofollow +#: model:ir.model,name:mail_optional_autofollow.model_mail_compose_message +msgid "Email composition wizard" +msgstr "" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,field_description:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "Make recipients followers" +msgstr "" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,help:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "" +"if checked, the additional recipients will be added as followers on " +"the related object" +msgstr "" diff --git a/mail_optional_autofollow/i18n/pt_BR.po b/mail_optional_autofollow/i18n/pt_BR.po new file mode 100644 index 0000000000..cafe3edc12 --- /dev/null +++ b/mail_optional_autofollow/i18n/pt_BR.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_autofollow +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-04-14 07:09+0000\n" +"PO-Revision-Date: 2016-04-05 07:05+0000\n" +"Last-Translator: <>\n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-" +"social-8-0/language/pt_BR/)\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: mail_optional_autofollow +#: model:ir.model,name:mail_optional_autofollow.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Assistente de Composição de Email" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,field_description:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "Make recipients followers" +msgstr "" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,help:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "" +"if checked, the additional recipients will be added as followers on " +"the related object" +msgstr "" diff --git a/mail_optional_autofollow/i18n/sl.po b/mail_optional_autofollow/i18n/sl.po new file mode 100644 index 0000000000..3c1b4c8c8c --- /dev/null +++ b/mail_optional_autofollow/i18n/sl.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_optional_autofollow +# +# Translators: +# Matjaž Mozetič , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-12 02:44+0000\n" +"PO-Revision-Date: 2016-06-11 22:15+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-social-9-0/" +"language/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \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_autofollow +#: model:ir.model,name:mail_optional_autofollow.model_mail_compose_message +msgid "Email composition wizard" +msgstr "Čarovnik za sestavljanje e-pošte" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,field_description:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "Make recipients followers" +msgstr "Prejemniki bodo sledilci" + +#. module: mail_optional_autofollow +#: model:ir.model.fields,help:mail_optional_autofollow.field_mail_compose_message__autofollow_recipients +msgid "" +"if checked, the additional recipients will be added as followers on " +"the related object" +msgstr "če označeno, se objektu dodajo dodatni prejemniki kot sledilci" diff --git a/mail_optional_autofollow/pyproject.toml b/mail_optional_autofollow/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/mail_optional_autofollow/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_optional_autofollow/static/description/autofollow.png b/mail_optional_autofollow/static/description/autofollow.png new file mode 100644 index 0000000000..ef1aa0f8e2 Binary files /dev/null and b/mail_optional_autofollow/static/description/autofollow.png differ diff --git a/mail_optional_autofollow/static/description/icon.png b/mail_optional_autofollow/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/mail_optional_autofollow/static/description/icon.png differ diff --git a/mail_optional_autofollow/tests/__init__.py b/mail_optional_autofollow/tests/__init__.py new file mode 100644 index 0000000000..dd099352b0 --- /dev/null +++ b/mail_optional_autofollow/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mail_optional_autofollow diff --git a/mail_optional_autofollow/tests/test_mail_optional_autofollow.py b/mail_optional_autofollow/tests/test_mail_optional_autofollow.py new file mode 100644 index 0000000000..f5b536e2d0 --- /dev/null +++ b/mail_optional_autofollow/tests/test_mail_optional_autofollow.py @@ -0,0 +1,53 @@ +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.fields import Command + +from odoo.addons.base.tests.common import BaseCommon + + +class TestAttachExistingAttachment(BaseCommon): + def setUp(self): + super().setUp() + self.partner_obj = self.env["res.partner"] + self.partner_01 = self.env.ref("base.res_partner_10") + self.partner_02 = self.env.ref("base.res_partner_address_17") + + def test_send_email_attachment(self): + ctx = self.env.context.copy() + ctx.update( + { + "default_model": "res.partner", + "default_res_ids": self.partner_01.ids, + "default_composition_mode": "comment", + } + ) + mail_compose = self.env["mail.compose.message"] + values = { + "partner_ids": [Command.link(self.partner_02.id)], + "composition_mode": "comment", + } + compose_id = mail_compose.with_context(**ctx).create(values) + compose_id.autofollow_recipients = False + compose_id.with_context(**ctx).action_send_mail() + res = self.env["mail.followers"].search( + [ + ("res_model", "=", "res.partner"), + ("res_id", "=", self.partner_01.id), + ("partner_id", "=", self.partner_02.id), + ] + ) + # I check if the recipient isn't a follower + self.assertEqual(len(res.ids), 0) + compose_id = mail_compose.with_context(**ctx).create(values) + compose_id.autofollow_recipients = True + compose_id.with_context(**ctx).action_send_mail() + res = self.env["mail.followers"].search( + [ + ("res_model", "=", "res.partner"), + ("res_id", "=", self.partner_01.id), + ("partner_id", "=", self.partner_02.id), + ] + ) + # I check if the recipient is a follower + self.assertEqual(len(res.ids), 1) diff --git a/mail_optional_autofollow/wizard/__init__.py b/mail_optional_autofollow/wizard/__init__.py new file mode 100644 index 0000000000..b528d997d1 --- /dev/null +++ b/mail_optional_autofollow/wizard/__init__.py @@ -0,0 +1 @@ +from . import mail_compose_message diff --git a/mail_optional_autofollow/wizard/mail_compose_message.py b/mail_optional_autofollow/wizard/mail_compose_message.py new file mode 100644 index 0000000000..4ce1809579 --- /dev/null +++ b/mail_optional_autofollow/wizard/mail_compose_message.py @@ -0,0 +1,36 @@ +# Copyright 2016 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class MailComposeMessage(models.TransientModel): + _inherit = "mail.compose.message" + + @api.model + def default_get(self, fields_list): + res = super().default_get(fields_list) + res.setdefault( + "autofollow_recipients", self.env.context.get("mail_post_autofollow", False) + ) + return res + + autofollow_recipients = fields.Boolean( + string="Make recipients followers", + help="""if checked, the additional recipients will be added as\ + followers on the related object""", + ) + + def _action_send_mail(self, auto_commit=False): + result_mails_su, result_messages = ( + self.env["mail.mail"].sudo(), + self.env["mail.message"], + ) + for wizard in self: + result_mails_su_wizard, result_messages_wizard = super( + MailComposeMessage, + wizard.with_context(mail_post_autofollow=wizard.autofollow_recipients), + )._action_send_mail(auto_commit=auto_commit) + result_mails_su += result_mails_su_wizard + result_messages += result_messages_wizard + return result_mails_su, result_messages diff --git a/mail_optional_autofollow/wizard/mail_compose_message_view.xml b/mail_optional_autofollow/wizard/mail_compose_message_view.xml new file mode 100644 index 0000000000..29572d9c02 --- /dev/null +++ b/mail_optional_autofollow/wizard/mail_compose_message_view.xml @@ -0,0 +1,16 @@ + + + + mail.compose.message.form (mail_optional_autofollow) + mail.compose.message + + + + + + + +