diff --git a/helpdesk_mgmt_reopen/__manifest__.py b/helpdesk_mgmt_reopen/__manifest__.py index 418c50f924..7e26ff9cd5 100644 --- a/helpdesk_mgmt_reopen/__manifest__.py +++ b/helpdesk_mgmt_reopen/__manifest__.py @@ -10,6 +10,7 @@ "summary": "Auto Helpdesk Reopen", "license": "AGPL-3", "author": "Odoo Community Association (OCA), OERP, Coop IT Easy SCRLfs, Akretion", + "maintainers": ["nayatec"], "website": "https://github.com/OCA/helpdesk", "depends": ["helpdesk_mgmt"], "installable": True, diff --git a/helpdesk_mgmt_reopen/models/mail_message.py b/helpdesk_mgmt_reopen/models/mail_message.py index 5646aeca26..aaf4f772b1 100644 --- a/helpdesk_mgmt_reopen/models/mail_message.py +++ b/helpdesk_mgmt_reopen/models/mail_message.py @@ -9,22 +9,12 @@ class MailMessage(models.Model): _inherit = "mail.message" - def is_production_env(self): - """Used to determine how we will treat comments. - It is useful because we can't (easily) mock - incoming emails in testing environnements - It needs to be implemented""" - return True - @api.model def is_reopener_message(self, vals): if not vals.get("model") == "helpdesk.ticket": return False if vals.get("message_type") == "notification": return False - # We need to use comments in non-prod env for testing purposes - if self.is_production_env() and vals.get("message_type") == "comment": - return False return True @api.model diff --git a/helpdesk_mgmt_reopen/readme/CONTRIBUTORS.rst b/helpdesk_mgmt_reopen/readme/CONTRIBUTORS.rst index cbe6065f89..ae92da109c 100644 --- a/helpdesk_mgmt_reopen/readme/CONTRIBUTORS.rst +++ b/helpdesk_mgmt_reopen/readme/CONTRIBUTORS.rst @@ -1,8 +1,11 @@ +* `Akretion `_: + + * Olivier Nibart + * `Coop IT Easy `_: * Pierrick Brun - * JSC Boolit * Andrius Laukavičius diff --git a/helpdesk_mgmt_reopen/readme/DESCRIPTION.rst b/helpdesk_mgmt_reopen/readme/DESCRIPTION.rst index dd49743ad8..d9c3393fa1 100644 --- a/helpdesk_mgmt_reopen/readme/DESCRIPTION.rst +++ b/helpdesk_mgmt_reopen/readme/DESCRIPTION.rst @@ -1,10 +1 @@ -This modules allows to get a ticket back to its first state when a message is -received about it. - - -When you are in a non-production environment, you can reopen the ticket with -a simple message as well. It is useful to test the module's function without -preparing a fake mail environment. - -There is a function MailMessage.is_production_env() allowing to define how you -select if you are in production or not. (With a check on the URL for instance) +This module allows getting a ticket back to its initial state when a message is received about it, except if it is a notification. \ No newline at end of file diff --git a/helpdesk_mgmt_reopen/tests/test_ticket_reopen.py b/helpdesk_mgmt_reopen/tests/test_ticket_reopen.py index 1b2131723a..74b26528ab 100644 --- a/helpdesk_mgmt_reopen/tests/test_ticket_reopen.py +++ b/helpdesk_mgmt_reopen/tests/test_ticket_reopen.py @@ -2,7 +2,6 @@ # @author Olivier Nibart # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from unittest import mock from odoo.tests.common import SavepointCase @@ -29,7 +28,7 @@ def setUpClass(cls): def test_is_reopener_message(self): vals = { "model": "not helpdesk.ticket", - "message_type": "not comment or notification", + "message_type": "not notification", } self.assertFalse(self.MailMessage.is_reopener_message(vals)) vals = { @@ -39,22 +38,7 @@ def test_is_reopener_message(self): self.assertFalse(self.MailMessage.is_reopener_message(vals)) vals = { "model": "helpdesk.ticket", - "message_type": "comment", - } - # type comment in production is not a reopener - self.assertTrue(self.MailMessage.is_production_env()) - self.assertFalse(self.MailMessage.is_reopener_message(vals)) - # type comment not in production is a reopener - with mock.patch.object( - type(self.MailMessage), - "is_production_env", - return_value=False, - ): - self.assertFalse(self.MailMessage.is_production_env()) - self.assertTrue(self.MailMessage.is_reopener_message(vals)) - vals = { - "model": "helpdesk.ticket", - "message_type": "not comment or notification", + "message_type": "not notification", } self.assertTrue(self.MailMessage.is_reopener_message(vals))