diff --git a/mail_print/README.rst b/mail_print/README.rst new file mode 100644 index 0000000000..0fb7af6613 --- /dev/null +++ b/mail_print/README.rst @@ -0,0 +1,81 @@ +================== +Mail Print Message +================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:dd21150507ec3adfe337e04f08c50127d7ecd7644dde4d56e77ce0ba6723ddd0 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/15.0/mail_print + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_print + :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=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows users to print messages from the chatter of any document. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, follow these steps: + +1. Navigate to the chatter of any document. +2. Hover the mouse over any message in the chatter (excluding internal notes). +3. A print icon will appear next to the message. +4. Click the print icon to generate a printable version of the message. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_print/__init__.py b/mail_print/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/mail_print/__manifest__.py b/mail_print/__manifest__.py new file mode 100644 index 0000000000..73a5ed19c2 --- /dev/null +++ b/mail_print/__manifest__.py @@ -0,0 +1,29 @@ +# Copyright 2024 Tecnativa - Carlos Lopez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Mail Print Message", + "version": "15.0.1.0.0", + "summary": "Print messages from the chatter of any document. ", + "author": "Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/social", + "depends": ["mail", "contacts"], + "data": [ + "data/report_paperformat_data.xml", + "reports/report_mail_message.xml", + "reports/reports.xml", + ], + "assets": { + "web.assets_backend": [ + "mail_print/static/src/components/**/*.esm.js", + ], + "web.assets_qweb": [ + "mail_print/static/src/components/*/*.xml", + ], + "web.assets_tests": [ + "mail_print/static/tests/tours/**/*", + ], + }, + "installable": True, + "auto_install": False, + "license": "AGPL-3", +} diff --git a/mail_print/data/report_paperformat_data.xml b/mail_print/data/report_paperformat_data.xml new file mode 100644 index 0000000000..e180904487 --- /dev/null +++ b/mail_print/data/report_paperformat_data.xml @@ -0,0 +1,15 @@ + + + + + Mail Message + A4 + Portrait + 30 + 20 + 5 + 5 + 25 + + + diff --git a/mail_print/i18n/es.po b/mail_print/i18n/es.po new file mode 100644 index 0000000000..3933397684 --- /dev/null +++ b/mail_print/i18n/es.po @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_print +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-01 12:27+0000\n" +"PO-Revision-Date: 2024-10-01 07: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: \n" +"X-Generator: Poedit 3.0.1\n" + +#. module: mail_print +#: model:ir.actions.report,print_report_name:mail_print.mail_message_report +msgid "(object.display_name)" +msgstr "" + +#. module: mail_print +#: model_terms:ir.ui.view,arch_db:mail_print.report_mail_message_document +msgid "" +"
\n" +" Reply-To: " +msgstr "" +"
\n" +" Responder a: " + +#. module: mail_print +#: model_terms:ir.ui.view,arch_db:mail_print.report_mail_message_document +msgid "" +"
\n" +" To: " +msgstr "" +"
\n" +" Para: " + +#. module: mail_print +#: model_terms:ir.ui.view,arch_db:mail_print.report_mail_message_document +msgid "Date: " +msgstr "Fecha: " + +#. module: mail_print +#: model:ir.actions.report,name:mail_print.mail_message_report +msgid "Message" +msgstr "Mensaje" + +#. module: mail_print +#. openerp-web +#: code:addons/mail_print/static/src/components/print_message/print_message.xml:0 +#, python-format +msgid "Print Message" +msgstr "Imprimir Mensaje" diff --git a/mail_print/i18n/mail_print.pot b/mail_print/i18n/mail_print.pot new file mode 100644 index 0000000000..29a806942b --- /dev/null +++ b/mail_print/i18n/mail_print.pot @@ -0,0 +1,53 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_print +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-01 12:27+0000\n" +"PO-Revision-Date: 2024-10-01 12:27+0000\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_print +#: model:ir.actions.report,print_report_name:mail_print.mail_message_report +msgid "(object.display_name)" +msgstr "" + +#. module: mail_print +#: model_terms:ir.ui.view,arch_db:mail_print.report_mail_message_document +msgid "" +"
\n" +" Reply-To: " +msgstr "" + +#. module: mail_print +#: model_terms:ir.ui.view,arch_db:mail_print.report_mail_message_document +msgid "" +"
\n" +" To: " +msgstr "" + +#. module: mail_print +#: model_terms:ir.ui.view,arch_db:mail_print.report_mail_message_document +msgid "Date: " +msgstr "" + +#. module: mail_print +#: model:ir.actions.report,name:mail_print.mail_message_report +msgid "Message" +msgstr "" + +#. module: mail_print +#. openerp-web +#: code:addons/mail_print/static/src/components/print_message/print_message.xml:0 +#: code:addons/mail_print/static/src/components/print_message/print_message.xml:0 +#, python-format +msgid "Print Message" +msgstr "" diff --git a/mail_print/readme/DESCRIPTION.rst b/mail_print/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..59ad80d1dc --- /dev/null +++ b/mail_print/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows users to print messages from the chatter of any document. diff --git a/mail_print/readme/USAGE.rst b/mail_print/readme/USAGE.rst new file mode 100644 index 0000000000..65b8cb5d02 --- /dev/null +++ b/mail_print/readme/USAGE.rst @@ -0,0 +1,6 @@ +To use this module, follow these steps: + +1. Navigate to the chatter of any document. +2. Hover the mouse over any message in the chatter (excluding internal notes). +3. A print icon will appear next to the message. +4. Click the print icon to generate a printable version of the message. diff --git a/mail_print/reports/report_mail_message.xml b/mail_print/reports/report_mail_message.xml new file mode 100644 index 0000000000..7df40f2103 --- /dev/null +++ b/mail_print/reports/report_mail_message.xml @@ -0,0 +1,31 @@ + + + + + + + diff --git a/mail_print/reports/reports.xml b/mail_print/reports/reports.xml new file mode 100644 index 0000000000..ed1bf4d4ad --- /dev/null +++ b/mail_print/reports/reports.xml @@ -0,0 +1,13 @@ + + + + Message + mail.message + qweb-pdf + mail_print.report_mail_message + mail_print.report_mail_message + (object.display_name) + + + + diff --git a/mail_print/static/description/index.html b/mail_print/static/description/index.html new file mode 100644 index 0000000000..a8a84235b0 --- /dev/null +++ b/mail_print/static/description/index.html @@ -0,0 +1,427 @@ + + + + + +Mail Print Message + + + +
+

Mail Print Message

+ + +

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

+

This module allows users to print messages from the chatter of any document.

+

Table of contents

+ +
+

Usage

+

To use this module, follow these steps:

+
    +
  1. Navigate to the chatter of any document.
  2. +
  3. Hover the mouse over any message in the chatter (excluding internal notes).
  4. +
  5. A print icon will appear next to the message.
  6. +
  7. Click the print icon to generate a printable version of the message.
  8. +
+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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 project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/mail_print/static/src/components/message_action_list/message_action_list.xml b/mail_print/static/src/components/message_action_list/message_action_list.xml new file mode 100644 index 0000000000..4dbf554f84 --- /dev/null +++ b/mail_print/static/src/components/message_action_list/message_action_list.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/mail_print/static/src/components/print_message/print_message.esm.js b/mail_print/static/src/components/print_message/print_message.esm.js new file mode 100644 index 0000000000..04b77560d6 --- /dev/null +++ b/mail_print/static/src/components/print_message/print_message.esm.js @@ -0,0 +1,28 @@ +/** @odoo-module **/ +/* Copyright 2024 Tecnativa - Carlos Lopez + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +*/ +import {registerMessagingComponent} from "@mail/utils/messaging_component"; +const {Component} = owl; + +export class PrintMessage extends Component { + onClickPrintMessage() { + this.env.bus.trigger("do-action", { + action: "mail_print.mail_message_report", + options: { + additional_context: { + active_id: this.props.message_id, + active_ids: [this.props.message_id], + active_model: "mail.message", + }, + }, + }); + } +} + +PrintMessage.template = "mail_print.PrintMessage"; +PrintMessage.props = { + message_id: Number, +}; + +registerMessagingComponent(PrintMessage); diff --git a/mail_print/static/src/components/print_message/print_message.xml b/mail_print/static/src/components/print_message/print_message.xml new file mode 100644 index 0000000000..d116d787f1 --- /dev/null +++ b/mail_print/static/src/components/print_message/print_message.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/mail_print/static/tests/tours/mail_print.esm.js b/mail_print/static/tests/tours/mail_print.esm.js new file mode 100644 index 0000000000..8272fe2aff --- /dev/null +++ b/mail_print/static/tests/tours/mail_print.esm.js @@ -0,0 +1,96 @@ +/** @odoo-module */ +/* Copyright 2024 Tecnativa - Carlos Lopez + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +*/ +import tour from "web_tour.tour"; +const contact_steps = [ + ...tour.stepUtils.goToAppSteps("contacts.menu_contacts", "Go to the Contacts."), + { + content: "Search Contact", + trigger: ".o_searchview_input", + run: "text Test", + }, + { + trigger: ".o_menu_item", + content: "Validate search", + run: "click", + }, + { + content: "Switch to list view", + trigger: ".o_list", + run: "click", + }, + { + content: "Open contact", + trigger: ".o_list_table td[name='display_name']:contains('Test')", + }, +]; +tour.register( + "mail_print.mail_print_tour", + { + test: true, + url: "/web", + }, + [ + ...contact_steps, + { + content: "Open Chat", + trigger: ".o_ChatterTopbar_buttonSendMessage", + run: "click", + }, + { + content: "Write a message", + trigger: ".o_ComposerTextInput_textarea", + run: "text Hello World", + }, + { + content: "Post a message", + trigger: ".o_Composer_buttonSend", + }, + { + content: "Hover a message", + trigger: "div.o_Message.o-discussion", + run: "click", + }, + { + content: "Print a message", + trigger: ".o_MessageActionList_actionPrint", + run: "click", + }, + ] +); + +tour.register( + "mail_print.mail_note_not_print_tour", + { + test: true, + url: "/web", + }, + [ + ...contact_steps, + { + content: "Open Chat", + trigger: ".o_ChatterTopbar_buttonLogNote", + run: "click", + }, + { + content: "Write a note", + trigger: ".o_ComposerTextInput_textarea", + run: "text This is a note", + }, + { + content: "Post a note", + trigger: ".o_Composer_buttonSend", + }, + { + content: "Hover a note", + trigger: "div.o_Message.o-not-discussion", + run: "click", + }, + { + content: "Verify that the Print button does not exist.", + trigger: + "div.o_Message.o-not-discussion:not(.o_MessageActionList_actionPrint)", + }, + ] +); diff --git a/mail_print/tests/__init__.py b/mail_print/tests/__init__.py new file mode 100644 index 0000000000..6cffb37e16 --- /dev/null +++ b/mail_print/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mail_print diff --git a/mail_print/tests/test_mail_print.py b/mail_print/tests/test_mail_print.py new file mode 100644 index 0000000000..b8cbeff83e --- /dev/null +++ b/mail_print/tests/test_mail_print.py @@ -0,0 +1,21 @@ +# Copyright 2024 Tecnativa - Carlos Lopez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo.tests import tagged +from odoo.tests.common import HttpCase + + +@tagged("post_install", "-at_install") +class TestMailPrint(HttpCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env["res.partner"].with_context(tracking_disable=True).create( + {"name": "Test", "email": "test@example.com"} + ) + + def test_01_mail_print_tour(self): + self.start_tour("/web", "mail_print.mail_print_tour", login="admin") + + def test_02_mail_note_not_print_tour(self): + self.start_tour("/web", "mail_print.mail_note_not_print_tour", login="admin") diff --git a/setup/mail_print/odoo/addons/mail_print b/setup/mail_print/odoo/addons/mail_print new file mode 120000 index 0000000000..d298d78530 --- /dev/null +++ b/setup/mail_print/odoo/addons/mail_print @@ -0,0 +1 @@ +../../../../mail_print \ No newline at end of file diff --git a/setup/mail_print/setup.py b/setup/mail_print/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/mail_print/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)