Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] mail_forward: Migration to version 17.0 #1536

Open
wants to merge 4 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions mail_forward/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
====================
Mail Forward Message
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f9107727227b807b8c178598ae0b5477c4692574ca4f87786cd4197027e23268
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/17.0/mail_forward
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_forward
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0
:alt: Try me on Runboat

|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.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, follow these steps:

- Navigate to the chatter of any document.
- Hover the mouse over any message in the chatter (excluding internal
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.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_forward%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:

- Carlos López

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

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.
2 changes: 2 additions & 0 deletions mail_forward/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
25 changes: 25 additions & 0 deletions mail_forward/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2024 Tecnativa - Carlos Lopez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Mail Forward Message",
"version": "17.0.1.0.0",
"summary": "Forward messages from the chatter of any document to other users.",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
"depends": ["mail", "contacts"],
"data": [
"wizards/mail_compose_message_view.xml",
],
"assets": {
"web.assets_backend": [
"mail_forward/static/src/**/*.esm.js",
"mail_forward/static/src/**/*.xml",
],
"web.assets_tests": [
"mail_forward/static/tests/tours/**/*",
],
},
"installable": True,
"auto_install": False,
"license": "AGPL-3",
}
83 changes: 83 additions & 0 deletions mail_forward/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_forward
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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"
"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"

#. module: mail_forward
#: code:addons/mail_forward/models/mail_message.py:0
#, python-format
msgid "---------- Forwarded message ---------"
msgstr "---------- Mensaje reenviado ---------"

#. module: mail_forward
#: code:addons/mail_forward/models/mail_message.py:0
#, python-format
msgid "Date"
msgstr "Fecha"

#. module: mail_forward
#: model:ir.model,name:mail_forward.model_mail_thread
msgid "Email Thread"
msgstr "Hilo de correos electrónicos"

#. 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"

#. module: mail_forward
#. openerp-web
#: code:addons/mail_forward/models/mail_message.py:0
#: code:addons/mail_forward/static/src/components/forward_message/forward_message.xml:0
#, python-format
msgid "Forward Message"
msgstr "Reenviar mensaje"

#. module: mail_forward
#: code:addons/mail_forward/models/mail_message.py:0
#, python-format
msgid "From"
msgstr "De"

#. module: mail_forward
#: code:addons/mail_forward/wizards/mail_compose_message.py:0
#, python-format
msgid "Fwd:"
msgstr ""

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

#. module: mail_forward
#: code:addons/mail_forward/wizards/mail_compose_message.py:0
#, python-format
msgid "Re:"
msgstr ""

#. module: mail_forward
#: code:addons/mail_forward/models/mail_message.py:0
#, python-format
msgid "Subject"
msgstr "Asunto"

#. module: mail_forward
#: code:addons/mail_forward/models/mail_message.py:0
#, python-format
msgid "To"
msgstr "Para"
101 changes: 101 additions & 0 deletions mail_forward/i18n/mail_forward.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_forward
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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_forward
#: code:addons/mail_forward/models/mail_message.py:0
#, python-format
msgid "---------- Forwarded message ---------"
msgstr ""

#. module: mail_forward
#: code:addons/mail_forward/models/mail_message.py:0
#, python-format
msgid "Date"
msgstr ""

#. module: mail_forward
#: model:ir.model,name:mail_forward.model_mail_thread
msgid "Email Thread"
msgstr ""

#. module: mail_forward
#: model:ir.model,name:mail_forward.model_mail_compose_message
msgid "Email composition wizard"
msgstr ""

#. module: mail_forward
#. openerp-web
#: code:addons/mail_forward/models/mail_message.py:0
#: code:addons/mail_forward/static/src/components/forward_message/forward_message.xml:0
#: code:addons/mail_forward/static/src/components/forward_message/forward_message.xml:0
#, python-format
msgid "Forward Message"
msgstr ""

#. module: mail_forward
#. openerp-web
#: code:addons/mail_forward/static/src/components/forward_message/forward_message.xml:0
#, python-format
msgid "Forward Message Center"
msgstr ""

#. module: mail_forward
#. openerp-web
#: code:addons/mail_forward/static/src/components/forward_message/forward_message.xml:0
#, python-format
msgid "Forward Message Left"
msgstr ""

#. module: mail_forward
#. openerp-web
#: code:addons/mail_forward/static/src/components/forward_message/forward_message.xml:0
#, python-format
msgid "Forward Message Right"
msgstr ""

#. module: mail_forward
#: code:addons/mail_forward/models/mail_message.py:0
#, python-format
msgid "From"
msgstr ""

#. module: mail_forward
#: code:addons/mail_forward/wizards/mail_compose_message.py:0
#, python-format
msgid "Fwd:"
msgstr ""

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

#. module: mail_forward
#: code:addons/mail_forward/wizards/mail_compose_message.py:0
#, python-format
msgid "Re:"
msgstr ""

#. module: mail_forward
#: code:addons/mail_forward/models/mail_message.py:0
#, python-format
msgid "Subject"
msgstr ""

#. module: mail_forward
#: code:addons/mail_forward/models/mail_message.py:0
#, python-format
msgid "To"
msgstr ""
2 changes: 2 additions & 0 deletions mail_forward/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import mail_message
from . import mail_thread
57 changes: 57 additions & 0 deletions mail_forward/models/mail_message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright 2024 Tecnativa - Carlos Lopez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, models
from odoo.tools import format_datetime


class MailMessage(models.Model):
_inherit = "mail.message"

def action_wizard_forward(self):
view = self.env.ref("mail_forward.mail_compose_message_forward_form")
action = self.env["ir.actions.actions"]._for_xml_id(
"mail.action_email_compose_message_wizard"
)
action["name"] = _("Forward Message")
action["view_mode"] = view.type
action["views"] = [(view.id, view.type)]
action["context"] = {
"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,
"message_forwarded_id": self.id,
}
return action

def _build_message_body_for_forward(self):
partner_emails = [
partner.email_formatted
for partner in self.partner_ids
if partner.email_formatted
]
return """
<br/><br/><br/>
{str_forwarded_message}<br/>
{str_from}: {email_from}<br/>
{str_date}: {date}<br/>
{str_subject}: {subject}<br/>
{str_to}: {to}<br/>
<br/><br/>
{body}
""".format(
str_forwarded_message=_("---------- Forwarded message ---------"),
email_from=self.email_from,
date=format_datetime(self.env, self.date),
subject=self.subject,
to=", ".join(partner_emails),
str_date=_("Date"),
str_subject=_("Subject"),
str_from=_("From"),
str_to=_("To"),
body=self.body,
)
19 changes: 19 additions & 0 deletions mail_forward/models/mail_thread.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 Tecnativa - Carlos Lopez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models


class MailThread(models.AbstractModel):
_inherit = "mail.thread"

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"):
current_partners_ids = message.partner_ids.ids
new_recipeints = []
for recipeint in recipients_data:
if recipeint["id"] in current_partners_ids:
new_recipeints.append(recipeint)
recipients_data = new_recipeints
return recipients_data
3 changes: 3 additions & 0 deletions mail_forward/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions mail_forward/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Tecnativa](https://www.tecnativa.com):
- Carlos López
Loading
Loading