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"} diff --git a/addons/mail_plugin/controllers/mail_plugin.py b/addons/mail_plugin/controllers/mail_plugin.py index 666105ec958..19f50679392 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) @@ -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)] 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