diff --git a/helpdesk_mgmt_portal_follower/README.rst b/helpdesk_mgmt_portal_follower/README.rst new file mode 100644 index 0000000000..b6bdb097cd --- /dev/null +++ b/helpdesk_mgmt_portal_follower/README.rst @@ -0,0 +1,137 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +=============== +Portal Follower +=============== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:4c468b603bc94823805521b28b037299d05c9bfcc41a94005091299319d4732b + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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%2Fhelpdesk-lightgray.png?logo=github + :target: https://github.com/OCA/helpdesk/tree/19.0/helpdesk_mgmt_portal_follower + :alt: OCA/helpdesk +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/helpdesk-19-0/helpdesk-19-0-helpdesk_mgmt_portal_follower + :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/helpdesk&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds the posibilty to add followers to a helpdesk ticket +from the helpdesk form at the website portal. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To make it work you just need to add the emails of the wanted followers +to the ``Emails in Copy`` input splitted by comas. + +Known issues / Roadmap +====================== + +Known Caveats +------------- + +1. **Spam Risks**: + + - Allowing users to input any email address could lead to spam if + unintended recipients are included. + +2. **Privacy Concerns**: + + - Users may inadvertently share sensitive information by adding + followers without the consent of the email address owners. + - This feature could expose email addresses to individuals who should + not have access to that information. + +3. **User Misunderstanding**: + + - End-users may not fully understand the implications of adding + multiple email addresses, potentially leading to confusion or + misuse. + +If you plan to use this module, it is essential to inform users about +the importance of carefully selecting followers to add. This process +will help maintain privacy and limit unnecessary notifications. + +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 +------- + +* Advanced Programming Solutions S.L. - APSL - Nagarro +* Bernat Obrador +* Patryk Pyczko +* Miquel Pascual + +Contributors +------------ + +- `APSL-Nagarro `__: + + - Patryk Pyczko ppyczko@apsl.net + - Bernat Obrador bobrador@apsl.net + - Miquel Pascual mpascual@apsl.net + - Antoni Marroig amarroig@apsl.net + +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. + +.. |maintainer-BernatObrador| image:: https://github.com/BernatObrador.png?size=40px + :target: https://github.com/BernatObrador + :alt: BernatObrador +.. |maintainer-ppyczko| image:: https://github.com/ppyczko.png?size=40px + :target: https://github.com/ppyczko + :alt: ppyczko +.. |maintainer-mpascuall| image:: https://github.com/mpascuall.png?size=40px + :target: https://github.com/mpascuall + :alt: mpascuall + +Current `maintainers `__: + +|maintainer-BernatObrador| |maintainer-ppyczko| |maintainer-mpascuall| + +This module is part of the `OCA/helpdesk `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/helpdesk_mgmt_portal_follower/__init__.py b/helpdesk_mgmt_portal_follower/__init__.py new file mode 100644 index 0000000000..e046e49fbe --- /dev/null +++ b/helpdesk_mgmt_portal_follower/__init__.py @@ -0,0 +1 @@ +from . import controllers diff --git a/helpdesk_mgmt_portal_follower/__manifest__.py b/helpdesk_mgmt_portal_follower/__manifest__.py new file mode 100644 index 0000000000..ed3a1dd7cf --- /dev/null +++ b/helpdesk_mgmt_portal_follower/__manifest__.py @@ -0,0 +1,17 @@ +{ + "name": "Portal Follower", + "summary": "Add ticket followers from website portal", + "author": ( + "Advanced Programming Solutions S.L. - APSL - Nagarro, " + "Bernat Obrador, Patryk Pyczko, Miquel Pascual, " + "Odoo Community Association (OCA)" + ), + "license": "AGPL-3", + "maintainers": ["BernatObrador", "ppyczko", "mpascuall"], + "website": "https://github.com/OCA/helpdesk", + "category": "Helpdesk", + "version": "19.0.1.0.0", + "depends": ["helpdesk_mgmt"], + "data": ["views/helpdesk_templates.xml"], + "installable": True, +} diff --git a/helpdesk_mgmt_portal_follower/controllers/__init__.py b/helpdesk_mgmt_portal_follower/controllers/__init__.py new file mode 100644 index 0000000000..12a7e529b6 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/controllers/__init__.py @@ -0,0 +1 @@ +from . import main diff --git a/helpdesk_mgmt_portal_follower/controllers/main.py b/helpdesk_mgmt_portal_follower/controllers/main.py new file mode 100644 index 0000000000..c20f686efb --- /dev/null +++ b/helpdesk_mgmt_portal_follower/controllers/main.py @@ -0,0 +1,34 @@ +import odoo.http as http +from odoo.http import request + +from odoo.addons.helpdesk_mgmt.controllers.main import HelpdeskTicketController + + +class HelpdeskTicketController(HelpdeskTicketController): + @http.route("/submitted/ticket", type="http", auth="user", website=True, csrf=True) + def submit_ticket(self, **kw): + res = super().submit_ticket(**kw) + ticket_id = res.location.split("/")[-1] + new_ticket = request.env["helpdesk.ticket"].browse(int(ticket_id)) + if kw.get("followers"): + emails = [ + email.strip() + for email in kw.get("followers").split(",") + if email.strip() + ] + partner_ids = [] + + for email in emails: + partner = request.env["res.partner"].search([("email", "=", email)]) + if not partner: + reg = { + "name": email, + "email": email, + "type": "contact", + } + partner = request.env["res.partner"].sudo().create(reg) + + partner_ids.append(partner.id) + + new_ticket.sudo().message_subscribe(partner_ids=partner_ids) + return res diff --git a/helpdesk_mgmt_portal_follower/i18n/ar.po b/helpdesk_mgmt_portal_follower/i18n/ar.po new file mode 100644 index 0000000000..e3f9da7bae --- /dev/null +++ b/helpdesk_mgmt_portal_follower/i18n/ar.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * helpdesk_mgmt_portal_follower +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: ar\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " +"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n" + +#. module: helpdesk_mgmt_portal_follower +#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_portal_follower.helpdesk_portal_add_followers +msgid "Emails in Copy" +msgstr "" + +#. module: helpdesk_mgmt_portal_follower +#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_portal_follower.helpdesk_portal_add_followers +msgid "example@example.com, ..." +msgstr "" diff --git a/helpdesk_mgmt_portal_follower/i18n/es.po b/helpdesk_mgmt_portal_follower/i18n/es.po new file mode 100644 index 0000000000..8d187e8890 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/i18n/es.po @@ -0,0 +1,28 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * helpdesk_mgmt_portal_follower +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-31 11:46+0000\n" +"PO-Revision-Date: 2026-05-10 10:19+0000\n" +"Last-Translator: Ed-Spain \n" +"Language-Team: \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 5.15.2\n" + +#. module: helpdesk_mgmt_portal_follower +#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_portal_follower.helpdesk_portal_add_followers +msgid "Emails in Copy" +msgstr "Correos en Copia" + +#. module: helpdesk_mgmt_portal_follower +#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_portal_follower.helpdesk_portal_add_followers +msgid "example@example.com, ..." +msgstr "ejemplo@ejemplo.com, ..." diff --git a/helpdesk_mgmt_portal_follower/i18n/helpdesk_mgmt_portal_follower.pot b/helpdesk_mgmt_portal_follower/i18n/helpdesk_mgmt_portal_follower.pot new file mode 100644 index 0000000000..51afa644b7 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/i18n/helpdesk_mgmt_portal_follower.pot @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * helpdesk_mgmt_portal_follower +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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: helpdesk_mgmt_portal_follower +#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_portal_follower.helpdesk_portal_add_followers +msgid "Emails in Copy" +msgstr "" + +#. module: helpdesk_mgmt_portal_follower +#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_portal_follower.helpdesk_portal_add_followers +msgid "example@example.com, ..." +msgstr "" diff --git a/helpdesk_mgmt_portal_follower/i18n/it.po b/helpdesk_mgmt_portal_follower/i18n/it.po new file mode 100644 index 0000000000..d13fa61f54 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/i18n/it.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * helpdesk_mgmt_portal_follower +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-11-03 17:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\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 5.6.2\n" + +#. module: helpdesk_mgmt_portal_follower +#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_portal_follower.helpdesk_portal_add_followers +msgid "Emails in Copy" +msgstr "E-mail in copia" + +#. module: helpdesk_mgmt_portal_follower +#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_portal_follower.helpdesk_portal_add_followers +msgid "example@example.com, ..." +msgstr "example@example.com, ..." diff --git a/helpdesk_mgmt_portal_follower/i18n/pt_BR.po b/helpdesk_mgmt_portal_follower/i18n/pt_BR.po new file mode 100644 index 0000000000..df4385f970 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/i18n/pt_BR.po @@ -0,0 +1,28 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * helpdesk_mgmt_portal_follower +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-12-19 16:06+0000\n" +"Last-Translator: Rodrigo Sottomaior Macedo " +"\n" +"Language-Team: none\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" +"X-Generator: Weblate 5.6.2\n" + +#. module: helpdesk_mgmt_portal_follower +#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_portal_follower.helpdesk_portal_add_followers +msgid "Emails in Copy" +msgstr "E-mails em cópia" + +#. module: helpdesk_mgmt_portal_follower +#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_portal_follower.helpdesk_portal_add_followers +msgid "example@example.com, ..." +msgstr "exemplo@exemplo.com, ..." diff --git a/helpdesk_mgmt_portal_follower/pyproject.toml b/helpdesk_mgmt_portal_follower/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/helpdesk_mgmt_portal_follower/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/helpdesk_mgmt_portal_follower/readme/CONTRIBUTORS.md b/helpdesk_mgmt_portal_follower/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..0fbec54731 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- [APSL-Nagarro](): + - Patryk Pyczko + - Bernat Obrador + - Miquel Pascual + - Antoni Marroig diff --git a/helpdesk_mgmt_portal_follower/readme/DESCRIPTION.md b/helpdesk_mgmt_portal_follower/readme/DESCRIPTION.md new file mode 100644 index 0000000000..8f5a798e23 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module adds the posibilty to add followers to a helpdesk ticket from the helpdesk form at the website portal. \ No newline at end of file diff --git a/helpdesk_mgmt_portal_follower/readme/ROADMAP.md b/helpdesk_mgmt_portal_follower/readme/ROADMAP.md new file mode 100644 index 0000000000..954c52fd90 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/readme/ROADMAP.md @@ -0,0 +1,13 @@ +## Known Caveats + +1. **Spam Risks**: + - Allowing users to input any email address could lead to spam if unintended recipients are included. + +2. **Privacy Concerns**: + - Users may inadvertently share sensitive information by adding followers without the consent of the email address owners. + - This feature could expose email addresses to individuals who should not have access to that information. + +3. **User Misunderstanding**: + - End-users may not fully understand the implications of adding multiple email addresses, potentially leading to confusion or misuse. + +If you plan to use this module, it is essential to inform users about the importance of carefully selecting followers to add. This process will help maintain privacy and limit unnecessary notifications. diff --git a/helpdesk_mgmt_portal_follower/readme/USAGE.md b/helpdesk_mgmt_portal_follower/readme/USAGE.md new file mode 100644 index 0000000000..9f1b0a8c59 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/readme/USAGE.md @@ -0,0 +1 @@ +To make it work you just need to add the emails of the wanted followers to the `Emails in Copy` input splitted by comas. \ No newline at end of file diff --git a/helpdesk_mgmt_portal_follower/static/description/icon.png b/helpdesk_mgmt_portal_follower/static/description/icon.png new file mode 100644 index 0000000000..7afac09f92 Binary files /dev/null and b/helpdesk_mgmt_portal_follower/static/description/icon.png differ diff --git a/helpdesk_mgmt_portal_follower/static/description/index.html b/helpdesk_mgmt_portal_follower/static/description/index.html new file mode 100644 index 0000000000..9ffb00075c --- /dev/null +++ b/helpdesk_mgmt_portal_follower/static/description/index.html @@ -0,0 +1,480 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Portal Follower

+ +

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

+

This module adds the posibilty to add followers to a helpdesk ticket +from the helpdesk form at the website portal.

+

Table of contents

+ +
+

Usage

+

To make it work you just need to add the emails of the wanted followers +to the Emails in Copy input splitted by comas.

+
+
+

Known issues / Roadmap

+
+

Known Caveats

+
    +
  1. Spam Risks:
      +
    • Allowing users to input any email address could lead to spam if +unintended recipients are included.
    • +
    +
  2. +
  3. Privacy Concerns:
      +
    • Users may inadvertently share sensitive information by adding +followers without the consent of the email address owners.
    • +
    • This feature could expose email addresses to individuals who should +not have access to that information.
    • +
    +
  4. +
  5. User Misunderstanding:
      +
    • End-users may not fully understand the implications of adding +multiple email addresses, potentially leading to confusion or +misuse.
    • +
    +
  6. +
+

If you plan to use this module, it is essential to inform users about +the importance of carefully selecting followers to add. This process +will help maintain privacy and limit unnecessary notifications.

+
+
+
+

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

+
    +
  • Advanced Programming Solutions S.L. - APSL - Nagarro
  • +
  • Bernat Obrador
  • +
  • Patryk Pyczko
  • +
  • Miquel Pascual
  • +
+
+
+

Contributors

+ +
+
+

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.

+

Current maintainers:

+

BernatObrador ppyczko mpascuall

+

This module is part of the OCA/helpdesk project on GitHub.

+

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

+
+
+
+
+ + diff --git a/helpdesk_mgmt_portal_follower/tests/__init__.py b/helpdesk_mgmt_portal_follower/tests/__init__.py new file mode 100644 index 0000000000..409efffc5e --- /dev/null +++ b/helpdesk_mgmt_portal_follower/tests/__init__.py @@ -0,0 +1 @@ +from . import test_ticket_followers diff --git a/helpdesk_mgmt_portal_follower/tests/test_ticket_followers.py b/helpdesk_mgmt_portal_follower/tests/test_ticket_followers.py new file mode 100644 index 0000000000..9f0ee31b87 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/tests/test_ticket_followers.py @@ -0,0 +1,74 @@ +from odoo import http + +from odoo.addons.base.tests.common import HttpCaseWithUserPortal + + +class TestSubmitPortalTicketBase(HttpCaseWithUserPortal): + @classmethod + def setUpClass(cls): + super().setUpClass() + + cls.new_ticket_title = "Test title" + cls.new_ticket_description = ("This is a test",) + cls.category = cls.env["helpdesk.ticket.category"].create({"name": "test"}) + cls.company = cls.env.ref("base.main_company") + + cls.follower_emails = "test1@testing.com, test2@testing.com" + cls.partner_model = cls.env["res.partner"] + cls.helpdesk_ticket_model = cls.env["helpdesk.ticket"] + + cls.partner_portal.parent_id = cls.company.partner_id + + def _submit_ticket_with_followers(self, response_code, **values): + data = { + "category": self.category.id, + "csrf_token": http.Request.csrf_token(self), + "subject": self.new_ticket_title, + "description": self.new_ticket_description, + "followers": self.follower_emails, + } + data.update(**values) + resp = self.url_open("/submitted/ticket", data=data) + self.assertEqual(resp.status_code, response_code) + return resp + + def _submit_ticket_without_followers(self, response_code, **values): + data = { + "category": self.category.id, + "csrf_token": http.Request.csrf_token(self), + "subject": self.new_ticket_title, + "description": self.new_ticket_description, + "followers": "", + } + data.update(**values) + resp = self.url_open("/submitted/ticket", data=data) + self.assertEqual(resp.status_code, response_code) + return resp + + +class TestSubmitPortalTicket(TestSubmitPortalTicketBase): + def test_submit_ticket_with_followers(self): + self.authenticate("portal", "portal") + self._submit_ticket_with_followers(response_code=200) + + ticket = self.helpdesk_ticket_model.search( + [("name", "=", self.new_ticket_title)] + ) + + for email in self.follower_emails.split(","): + partner = self.partner_model.search([("email", "=", email.strip())]) + self.assertEqual(len(partner), 1) + self.assertIn(partner.id, ticket.message_partner_ids.ids) + + def test_submit_ticket_without_followers(self): + self.authenticate("portal", "portal") + self._submit_ticket_without_followers(response_code=200) + + ticket = self.helpdesk_ticket_model.search( + [("name", "=", self.new_ticket_title)] + ) + + for email in self.follower_emails.split(","): + partner = self.partner_model.search([("email", "=", email.strip())]) + self.assertEqual(len(partner), 0) + self.assertNotIn(partner.id, ticket.message_partner_ids.ids) diff --git a/helpdesk_mgmt_portal_follower/views/helpdesk_templates.xml b/helpdesk_mgmt_portal_follower/views/helpdesk_templates.xml new file mode 100644 index 0000000000..a453278068 --- /dev/null +++ b/helpdesk_mgmt_portal_follower/views/helpdesk_templates.xml @@ -0,0 +1,27 @@ + + +