From a69366ef0320a988460e81f5c1f384f7cabec79e Mon Sep 17 00:00:00 2001 From: std-odoo Date: Tue, 22 Feb 2022 10:29:05 +0000 Subject: [PATCH 1/4] [FIX] mail_plugin: fix traceback when the partner has been removed Bug === 1. Open an email in Outlook, and create the contact 2. Go to Odoo and remove the partner 3. Without refreshing the browser tab, click on the "reload" icon of the addin. A traceback will be raised on the Odoo side Task-2601837 X-original-commit: bb2e5ce9cf149a5cfd68cf908184c823f882d97d Part-of: odoo/odoo#89848 --- addons/mail_plugin/controllers/mail_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail_plugin/controllers/mail_plugin.py b/addons/mail_plugin/controllers/mail_plugin.py index 666105ec958..5ca600a954c 100644 --- a/addons/mail_plugin/controllers/mail_plugin.py +++ b/addons/mail_plugin/controllers/mail_plugin.py @@ -144,7 +144,7 @@ class MailPluginController(http.Controller): return {'error': _('You need to specify at least the partner_id or the name and the email')} if partner_id: - partner = request.env['res.partner'].browse(partner_id) + partner = request.env['res.partner'].browse(partner_id).exists() return self._get_contact_data(partner) normalized_email = tools.email_normalize(email) From 742e9a24d115b29292a16cb5e8e5048350c28590 Mon Sep 17 00:00:00 2001 From: std-odoo Date: Mon, 28 Feb 2022 13:41:33 +0000 Subject: [PATCH 2/4] [FIX] mail_plugin: fix error in the console when logged with the addin Bug === When we log in with the addin, it will fetch the route `/mail_plugin/auth/access_token` to know if the module is installed. Because we give no `auth_code` an error is displayed in the console. Task-2601837 X-original-commit: 26944c09de32512a8072e00ac73a90c633eecb6c Part-of: odoo/odoo#89848 --- addons/mail_plugin/controllers/authenticate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/mail_plugin/controllers/authenticate.py b/addons/mail_plugin/controllers/authenticate.py index 1b0f9d1103b..8ef89d8b4e5 100644 --- a/addons/mail_plugin/controllers/authenticate.py +++ b/addons/mail_plugin/controllers/authenticate.py @@ -55,7 +55,7 @@ class Authenticate(http.Controller): # In this case, an exception will be thrown in case of preflight request if only POST is allowed. @http.route(['/mail_client_extension/auth/access_token', '/mail_plugin/auth/access_token'], type='json', auth="none", cors="*", methods=['POST', 'OPTIONS']) - def auth_access_token(self, auth_code, **kw): + def auth_access_token(self, auth_code='', **kw): """ Called by the external app to exchange an auth code, which is temporary and was passed in a URL, for an access token, which is permanent, and can be used in the `Authorization` header to authorize subsequent requests @@ -63,6 +63,8 @@ class Authenticate(http.Controller): old route name "/mail_client_extension/auth/access_token is deprecated as of saas-14.3,it is not needed for newer versions of the mail plugin but necessary for supporting older versions """ + if not auth_code: + return {"error": "Invalid code"} auth_message = self._get_auth_code_data(auth_code) if not auth_message: return {"error": "Invalid code"} From af82dc2a9aaa3fe8a6d4b00be6048ebd9016e03f Mon Sep 17 00:00:00 2001 From: std-odoo Date: Wed, 9 Mar 2022 07:52:05 +0000 Subject: [PATCH 3/4] [IMP] mail_plugin: never let the company section empty Purpose ======= When you do not have IAP credit, if the partner and the company do not exist in the Odoo database, you have an empty section. Now, a message tell you that you need to save the partner to generate the company (so the section is not empty anymore). Add the translation for this text. Task-2601837 X-original-commit: 2951b41ba639fbe6e1bec9ef53ca300369ad5a74 Part-of: odoo/odoo#89848 --- addons/mail_plugin/i18n/mail_plugin.pot | 7 +++++++ .../static/src/to_translate/translations_outlook.xml | 1 + 2 files changed, 8 insertions(+) diff --git a/addons/mail_plugin/i18n/mail_plugin.pot b/addons/mail_plugin/i18n/mail_plugin.pot index 24573b90cf3..364220c1136 100644 --- a/addons/mail_plugin/i18n/mail_plugin.pot +++ b/addons/mail_plugin/i18n/mail_plugin.pot @@ -645,6 +645,13 @@ msgstr "" msgid "Save in Odoo" msgstr "" +#. module: mail_plugin +#. openerp-web +#: code:addons/mail_plugin/static/src/to_translate/translations_outlook.xml:0 +#, python-format +msgid "Save the contact to create the company" +msgstr "" + #. module: mail_plugin #. openerp-web #: code:addons/mail_plugin/static/src/to_translate/translations_gmail.xml:0 diff --git a/addons/mail_plugin/static/src/to_translate/translations_outlook.xml b/addons/mail_plugin/static/src/to_translate/translations_outlook.xml index e26d7c68397..9d0ec2776d6 100644 --- a/addons/mail_plugin/static/src/to_translate/translations_outlook.xml +++ b/addons/mail_plugin/static/src/to_translate/translations_outlook.xml @@ -48,4 +48,5 @@ From : %(email)s Logged from Outlook Inbox + Save the contact to create the company From c967cda61fe5b876b31372047d4d55c304118cb2 Mon Sep 17 00:00:00 2001 From: std-odoo Date: Wed, 20 Apr 2022 07:31:03 +0000 Subject: [PATCH 4/4] [IMP] mail_plugin: when searching a non-full email no result are returned Task-2601837 X-original-commit: 2c2e927ad3c07a9a8acdda06ff379dfc7ce07722 Part-of: odoo/odoo#89848 --- addons/mail_plugin/controllers/mail_plugin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/mail_plugin/controllers/mail_plugin.py b/addons/mail_plugin/controllers/mail_plugin.py index 5ca600a954c..19f50679392 100644 --- a/addons/mail_plugin/controllers/mail_plugin.py +++ b/addons/mail_plugin/controllers/mail_plugin.py @@ -184,11 +184,10 @@ class MailPluginController(http.Controller): search on. The method returns an array containing the dicts of the matched contacts. """ - normalized_email = tools.email_normalize(search_term) if normalized_email: - filter_domain = [('email_normalized', '=', search_term)] + filter_domain = [('email_normalized', 'ilike', search_term)] else: filter_domain = ['|', '|', ('display_name', 'ilike', search_term), ('ref', '=', search_term), ('email', 'ilike', search_term)]