Skip to content

Commit

Permalink
[IMP] mail_forward: Add option to forward a message to another thread
Browse files Browse the repository at this point in the history
This option posts a new message in the other thread, including the attachments, but does not add them as followers—only notifying the current followers of the other thread.
  • Loading branch information
carlos-lopez-tecnativa committed Jan 27, 2025
1 parent 679bcfa commit 6a3d5f6
Show file tree
Hide file tree
Showing 16 changed files with 442 additions and 63 deletions.
35 changes: 30 additions & 5 deletions mail_forward/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,29 @@ Mail Forward Message
|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows users to forward messages from the chatter of any
document to other users, adding them as followers of the document
without notifying the current followers.
document to:

- Other users in the same thread, adding them as followers of the
document without notifying the current followers.
- Another thread, but not adding them as followers—only notifying the
current followers of the other thread.

**Table of contents**

.. contents::
:local:

Configuration
=============

To enable a model to forward messages to another thread:

- With debug mode activated, go to
``Settings -> Technical -> Database Structure -> Models``.
- Search for the model you wish to enable.
- Mark the option ``Enable Forward To`` and save. Transient models or
those without mail thread won't have this check visible.

Usage
=====

Expand All @@ -47,9 +62,11 @@ To use this module, follow these steps:
notes).
- A Forward icon will appear next to the message.
- Click the button to display a wizard with the message.
- Select the users to forward the message to.
- Click the 'Send Mail' button to send the message to the selected
users.
- Select the forward type (current thread or another thread).
- Select the users to forward the message to, or select the other thread
according to the previous step.
- Click the 'Send Mail' button to send the message to the selected users
or thread.

Bug Tracker
===========
Expand Down Expand Up @@ -89,6 +106,14 @@ 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.

.. |maintainer-carlos-lopez-tecnativa| image:: https://github.com/carlos-lopez-tecnativa.png?size=40px
:target: https://github.com/carlos-lopez-tecnativa
:alt: carlos-lopez-tecnativa

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-carlos-lopez-tecnativa|

This module is part of the `OCA/social <https://github.com/OCA/social/tree/17.0/mail_forward>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 2 additions & 3 deletions mail_forward/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
"depends": ["mail", "contacts"],
"data": [
"wizards/mail_compose_message_view.xml",
],
"data": ["wizards/mail_compose_message_view.xml", "views/ir_model_views.xml"],
"assets": {
"web.assets_backend": [
"mail_forward/static/src/**/*.esm.js",
Expand All @@ -22,4 +20,5 @@
"installable": True,
"auto_install": False,
"license": "AGPL-3",
"maintainers": ["carlos-lopez-tecnativa"],
}
56 changes: 48 additions & 8 deletions mail_forward/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-02 12:25+0000\n"
"PO-Revision-Date: 2024-10-02 07:27-0500\n"
"POT-Creation-Date: 2025-01-27 17:26+0000\n"
"PO-Revision-Date: 2025-01-27 12:28-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.0.1\n"
"X-Generator: Poedit 3.5\n"

#. module: mail_forward
#. odoo-python
Expand All @@ -24,6 +24,16 @@ msgstr ""
msgid "---------- Forwarded message ---------"
msgstr "---------- Mensaje reenviado ---------"

#. module: mail_forward
#: model:ir.model.fields.selection,name:mail_forward.selection__mail_compose_message__forward_type__another_thread
msgid "Another thread"
msgstr "Otro hilo"

#. module: mail_forward
#: model:ir.model.fields.selection,name:mail_forward.selection__mail_compose_message__forward_type__current_thread
msgid "Current thread"
msgstr "Hilo actual"

#. module: mail_forward
#. odoo-python
#: code:addons/mail_forward/models/mail_message.py:0
Expand All @@ -34,20 +44,35 @@ msgstr "Fecha"
#. module: mail_forward
#: model:ir.model,name:mail_forward.model_mail_thread
msgid "Email Thread"
msgstr "Hilo de correos electrónicos"
msgstr "Hilo de correo electrónico"

#. module: mail_forward
#: model:ir.model,name:mail_forward.model_mail_compose_message
msgid "Email composition wizard"
msgstr "Asistente de composición de correos electrónicos"
msgstr "Asistente de redacción de correo electrónico"

#. module: mail_forward
#: model:ir.model.fields,field_description:mail_forward.field_ir_model__enable_forward_to
msgid "Enable Forward To"
msgstr "Habilitar reenvío a"

#. module: mail_forward
#: model:ir.model.fields,help:mail_forward.field_ir_model__enable_forward_to
msgid "Enable forwarding messages to records of this model."
msgstr "Habilita el reenvío de mensajes a registros de este modelo."

#. module: mail_forward
#: model_terms:ir.ui.view,arch_db:mail_forward.mail_compose_message_forward_form
msgid "Followers to notify"
msgstr "Seguidores a notificar"

#. module: mail_forward
#. odoo-javascript
#: code:addons/mail_forward/static/src/components/forward_message/forward_message.xml:0
#: code:addons/mail_forward/static/src/core/common/message_actions.esm.js:0
#, python-format
msgid "Forward"
msgstr ""
msgstr "Reenviar"

#. module: mail_forward
#. odoo-javascript
Expand Down Expand Up @@ -79,6 +104,11 @@ msgstr ""
msgid "Forward Message Right"
msgstr ""

#. module: mail_forward
#: model:ir.model.fields,field_description:mail_forward.field_mail_compose_message__forward_type
msgid "Forward Type"
msgstr "Tipo de reenvío"

#. module: mail_forward
#. odoo-python
#: code:addons/mail_forward/models/mail_message.py:0
Expand All @@ -91,13 +121,18 @@ msgstr "De"
#: code:addons/mail_forward/wizards/mail_compose_message.py:0
#, python-format
msgid "Fwd:"
msgstr ""
msgstr "Re:"

#. module: mail_forward
#: model:ir.model,name:mail_forward.model_mail_message
msgid "Message"
msgstr "Mensaje"

#. module: mail_forward
#: model:ir.model,name:mail_forward.model_ir_model
msgid "Models"
msgstr "Modelos"

#. module: mail_forward
#. odoo-python
#: code:addons/mail_forward/wizards/mail_compose_message.py:0
Expand All @@ -112,6 +147,11 @@ msgstr ""
msgid "Subject"
msgstr "Asunto"

#. module: mail_forward
#: model:ir.model.fields,field_description:mail_forward.field_mail_compose_message__forward_thread
msgid "Thread to forward"
msgstr "Hilo a reenviar"

#. module: mail_forward
#. odoo-python
#: code:addons/mail_forward/models/mail_message.py:0
Expand Down
42 changes: 42 additions & 0 deletions mail_forward/i18n/mail_forward.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-27 17:26+0000\n"
"PO-Revision-Date: 2025-01-27 17:26+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -20,6 +22,16 @@ msgstr ""
msgid "---------- Forwarded message ---------"
msgstr ""

#. module: mail_forward
#: model:ir.model.fields.selection,name:mail_forward.selection__mail_compose_message__forward_type__another_thread
msgid "Another thread"
msgstr ""

#. module: mail_forward
#: model:ir.model.fields.selection,name:mail_forward.selection__mail_compose_message__forward_type__current_thread
msgid "Current thread"
msgstr ""

#. module: mail_forward
#. odoo-python
#: code:addons/mail_forward/models/mail_message.py:0
Expand All @@ -37,6 +49,21 @@ msgstr ""
msgid "Email composition wizard"
msgstr ""

#. module: mail_forward
#: model:ir.model.fields,field_description:mail_forward.field_ir_model__enable_forward_to
msgid "Enable Forward To"
msgstr ""

#. module: mail_forward
#: model:ir.model.fields,help:mail_forward.field_ir_model__enable_forward_to
msgid "Enable forwarding messages to records of this model."
msgstr ""

#. module: mail_forward
#: model_terms:ir.ui.view,arch_db:mail_forward.mail_compose_message_forward_form
msgid "Followers to notify"
msgstr ""

#. module: mail_forward
#. odoo-javascript
#: code:addons/mail_forward/static/src/components/forward_message/forward_message.xml:0
Expand Down Expand Up @@ -76,6 +103,11 @@ msgstr ""
msgid "Forward Message Right"
msgstr ""

#. module: mail_forward
#: model:ir.model.fields,field_description:mail_forward.field_mail_compose_message__forward_type
msgid "Forward Type"
msgstr ""

#. module: mail_forward
#. odoo-python
#: code:addons/mail_forward/models/mail_message.py:0
Expand All @@ -95,6 +127,11 @@ msgstr ""
msgid "Message"
msgstr ""

#. module: mail_forward
#: model:ir.model,name:mail_forward.model_ir_model
msgid "Models"
msgstr ""

#. module: mail_forward
#. odoo-python
#: code:addons/mail_forward/wizards/mail_compose_message.py:0
Expand All @@ -109,6 +146,11 @@ msgstr ""
msgid "Subject"
msgstr ""

#. module: mail_forward
#: model:ir.model.fields,field_description:mail_forward.field_mail_compose_message__forward_thread
msgid "Thread to forward"
msgstr ""

#. module: mail_forward
#. odoo-python
#: code:addons/mail_forward/models/mail_message.py:0
Expand Down
1 change: 1 addition & 0 deletions mail_forward/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from . import ir_model
from . import mail_message
from . import mail_thread
9 changes: 9 additions & 0 deletions mail_forward/models/ir_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import fields, models


class IrModel(models.Model):
_inherit = "ir.model"

enable_forward_to = fields.Boolean(
help="Enable forwarding messages to records of this model."
)
2 changes: 0 additions & 2 deletions mail_forward/models/mail_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ def action_wizard_forward(self):
"default_model": self.model,
"default_res_ids": [self.res_id],
"default_composition_mode": "comment",
"default_body": self._build_message_body_for_forward(),
"default_attachment_ids": self.attachment_ids.ids,
"default_is_log": False,
"default_notify": True,
"force_email": True,
Expand Down
5 changes: 4 additions & 1 deletion mail_forward/models/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ class MailThread(models.AbstractModel):
def _notify_get_recipients(self, message, msg_vals, **kwargs):
recipients_data = super()._notify_get_recipients(message, msg_vals, **kwargs)
# only notify to explicit partners, remove others(followers).
if self.env.context.get("message_forwarded_id"):
if (
self.env.context.get("message_forwarded_id")
and self.env.context.get("forward_type", "") == "current_thread"
):
current_partners_ids = message.partner_ids.ids
new_recipeints = []
for recipeint in recipients_data:
Expand Down
5 changes: 5 additions & 0 deletions mail_forward/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To enable a model to forward messages to another thread:

- With debug mode activated, go to `Settings -> Technical -> Database Structure -> Models`.
- Search for the model you wish to enable.
- Mark the option `Enable Forward To` and save. Transient models or those without mail thread won't have this check visible.
6 changes: 3 additions & 3 deletions mail_forward/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This module allows users to forward messages from the chatter of any
document to other users, adding them as followers of the document
without notifying the current followers.
This module allows users to forward messages from the chatter of any document to:
- Other users in the same thread, adding them as followers of the document without notifying the current followers.
- Another thread, but not adding them as followers—only notifying the current followers of the other thread.
7 changes: 4 additions & 3 deletions mail_forward/readme/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ To use this module, follow these steps:
notes).
- A Forward icon will appear next to the message.
- Click the button to display a wizard with the message.
- Select the users to forward the message to.
- Click the 'Send Mail' button to send the message to the selected
users.
- Select the forward type (current thread or another thread).
- Select the users to forward the message to, or select the other thread according to the previous step.
- Click the 'Send Mail' button to send the message to the selected users or thread.

Loading

0 comments on commit 6a3d5f6

Please sign in to comment.