From ed30d227081c85b14efb0d42c1e26412828e847e Mon Sep 17 00:00:00 2001 From: Telmo Santos Date: Thu, 2 Feb 2023 14:10:27 +0100 Subject: [PATCH] Deprecate microsoft_outlook_single_tenant Odoo added the possibility to customize microsoft authentication endpoint. Therefore this module is not needed anymore. --- microsoft_outlook_single_tenant/__init__.py | 1 + .../__manifest__.py | 2 +- microsoft_outlook_single_tenant/hooks.py | 19 +++++++++++++++++++ .../tests/test_fetchmail_outlook.py | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 microsoft_outlook_single_tenant/hooks.py diff --git a/microsoft_outlook_single_tenant/__init__.py b/microsoft_outlook_single_tenant/__init__.py index 0650744f6b..c92d83cae2 100644 --- a/microsoft_outlook_single_tenant/__init__.py +++ b/microsoft_outlook_single_tenant/__init__.py @@ -1 +1,2 @@ from . import models +from . import hooks diff --git a/microsoft_outlook_single_tenant/__manifest__.py b/microsoft_outlook_single_tenant/__manifest__.py index 9912c1e5bc..4f6b58d20f 100644 --- a/microsoft_outlook_single_tenant/__manifest__.py +++ b/microsoft_outlook_single_tenant/__manifest__.py @@ -1,7 +1,7 @@ # Copyright 2022 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) { - "name": "Microsoft Outlook Single Tenant", + "name": "Microsoft Outlook Single Tenant (DEPRECATED)", "version": "14.0.1.0.0", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", diff --git a/microsoft_outlook_single_tenant/hooks.py b/microsoft_outlook_single_tenant/hooks.py new file mode 100644 index 0000000000..3f87a84437 --- /dev/null +++ b/microsoft_outlook_single_tenant/hooks.py @@ -0,0 +1,19 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +import logging + +_logger = logging.getLogger(__name__) + + +def deprecate(): + _logger.warning( + """ + `microsoft_outlook_single_tenant` is deprecated. + Configure microsoft_outlook.endpoint ir.config_parameter + """ + ) + + +def post_load_hook(): + deprecate() diff --git a/microsoft_outlook_single_tenant/tests/test_fetchmail_outlook.py b/microsoft_outlook_single_tenant/tests/test_fetchmail_outlook.py index cd216aef36..e189c7b424 100644 --- a/microsoft_outlook_single_tenant/tests/test_fetchmail_outlook.py +++ b/microsoft_outlook_single_tenant/tests/test_fetchmail_outlook.py @@ -30,6 +30,10 @@ def test_default_app_endpoint(self): self.assertIn(common_endpoint, mail_server.microsoft_outlook_uri) def test_single_tenant_app_endpoint(self): + self.env["ir.config_parameter"].sudo().set_param( + "microsoft_outlook.endpoint", + "https://login.microsoftonline.com/test_directory_tenant_id/oauth2/v2.0/", + ) self.env["res.config.settings"].create( { "microsoft_outlook_client_identifier": "test_client_id",