Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3631 from ForgeFlow/12.0-update-upstream-c53081f10be
[12.0] update upstream c53081f
- Loading branch information
Showing
10 changed files
with
512 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * fetchmail_gmail | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0+e\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2022-05-13 06:43+0000\n" | ||
"PO-Revision-Date: 2022-05-13 06:43+0000\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: fetchmail_gmail | ||
#: model_terms:ir.ui.view,arch_db:fetchmail_gmail.fetchmail_server_view_form | ||
msgid "Authorization Code" | ||
msgstr "" | ||
|
||
#. module: fetchmail_gmail | ||
#: model_terms:ir.ui.view,arch_db:fetchmail_gmail.fetchmail_server_view_form | ||
msgid "Gmail" | ||
msgstr "" | ||
|
||
#. module: fetchmail_gmail | ||
#: code:addons/fetchmail_gmail/models/fetchmail_server.py:15 | ||
#, python-format | ||
msgid "Gmail authentication only supports IMAP server type." | ||
msgstr "" | ||
|
||
#. module: fetchmail_gmail | ||
#: model:ir.model,name:fetchmail_gmail.model_fetchmail_server | ||
msgid "Incoming Mail Server" | ||
msgstr "" | ||
|
||
#. module: fetchmail_gmail | ||
#: model_terms:ir.ui.view,arch_db:fetchmail_gmail.fetchmail_server_view_form | ||
msgid "Setup your Gmail API credentials in the general settings to link a Gmail account." | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from . import controllers | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -* | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from . import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
import json | ||
import logging | ||
import werkzeug | ||
|
||
from werkzeug.exceptions import Forbidden | ||
from werkzeug.urls import url_encode | ||
|
||
from odoo import _, http | ||
from odoo.exceptions import UserError | ||
from odoo.http import request | ||
from odoo.tools import consteq | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class GoogleGmailController(http.Controller): | ||
@http.route('/google_gmail/confirm', type='http', auth='user') | ||
def google_gmail_callback(self, code=None, state=None, error=None, **kwargs): | ||
"""Callback URL during the OAuth process. | ||
Gmail redirects the user browser to this endpoint with the authorization code. | ||
We will fetch the refresh token and the access token thanks to this authorization | ||
code and save those values on the given mail server. | ||
""" | ||
if not request.env.user.has_group('base.group_system'): | ||
_logger.error('Google Gmail: non-system user trying to link an Gmail account.') | ||
raise Forbidden() | ||
|
||
if error: | ||
return _('An error occur during the authentication process: %s.') % error | ||
|
||
try: | ||
state = json.loads(state) | ||
model_name = state['model'] | ||
rec_id = state['id'] | ||
csrf_token = state['csrf_token'] | ||
except Exception: | ||
_logger.error('Google Gmail: Wrong state value %r.', state) | ||
raise Forbidden() | ||
|
||
model = request.env[model_name] | ||
|
||
if not issubclass(type(model), request.env.registry['google.gmail.mixin']): | ||
# The model must inherits from the "google.gmail.mixin" mixin | ||
raise Forbidden() | ||
|
||
record = model.browse(rec_id).exists() | ||
if not record: | ||
raise Forbidden() | ||
|
||
if not csrf_token or not consteq(csrf_token, record._get_gmail_csrf_token()): | ||
_logger.error('Google Gmail: Wrong CSRF token during Gmail authentication.') | ||
raise Forbidden() | ||
|
||
try: | ||
refresh_token, access_token, expiration = record._fetch_gmail_refresh_token(code) | ||
except UserError as e: | ||
return _('An error occur during the authentication process: %s.') % str(e.name) | ||
|
||
record.write({ | ||
'google_gmail_access_token': access_token, | ||
'google_gmail_access_token_expiration': expiration, | ||
'google_gmail_authorization_code': code, | ||
'google_gmail_refresh_token': refresh_token, | ||
}) | ||
|
||
url_params = { | ||
'id': rec_id, | ||
'model': model_name, | ||
'view_type': 'form' | ||
} | ||
url = '/web?#' + url_encode(url_params) | ||
return werkzeug.utils.redirect(url, 303) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * google_gmail | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0+e\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2022-05-13 06:43+0000\n" | ||
"PO-Revision-Date: 2022-05-13 06:43+0000\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: google_gmail | ||
#: model_terms:ir.ui.view,arch_db:google_gmail.res_config_settings_view_form | ||
msgid "<span class=\"o_form_label\">Gmail Credentials</span>" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_google_gmail_mixin__google_gmail_access_token | ||
#: model:ir.model.fields,field_description:google_gmail.field_ir_mail_server__google_gmail_access_token | ||
msgid "Access Token" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_google_gmail_mixin__google_gmail_access_token_expiration | ||
#: model:ir.model.fields,field_description:google_gmail.field_ir_mail_server__google_gmail_access_token_expiration | ||
msgid "Access Token Expiration Timestamp" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: code:addons/google_gmail/controllers/main.py:33 | ||
#, python-format | ||
msgid "An error occur during the authentication process: %s." | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: code:addons/google_gmail/models/google_gmail_mixin.py:136 | ||
#, python-format | ||
msgid "An error occurred when fetching the access token." | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_google_gmail_mixin__google_gmail_authorization_code | ||
#: model:ir.model.fields,field_description:google_gmail.field_ir_mail_server__google_gmail_authorization_code | ||
#: model_terms:ir.ui.view,arch_db:google_gmail.ir_mail_server_view_form | ||
msgid "Authorization Code" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model_terms:ir.ui.view,arch_db:google_gmail.res_config_settings_view_form | ||
msgid "Client ID" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model_terms:ir.ui.view,arch_db:google_gmail.res_config_settings_view_form | ||
msgid "Client Secret" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model,name:google_gmail.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_google_gmail_mixin__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model_terms:ir.ui.view,arch_db:google_gmail.ir_mail_server_view_form | ||
msgid "Gmail" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_google_gmail_mixin__use_google_gmail_service | ||
#: model:ir.model.fields,field_description:google_gmail.field_ir_mail_server__use_google_gmail_service | ||
msgid "Gmail Authentication" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_res_config_settings__google_gmail_client_identifier | ||
msgid "Gmail Client Id" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_res_config_settings__google_gmail_client_secret | ||
msgid "Gmail Client Secret" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model,name:google_gmail.model_google_gmail_mixin | ||
msgid "Google Gmail Mixin" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_google_gmail_mixin__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_google_gmail_mixin____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model,name:google_gmail.model_ir_mail_server | ||
msgid "Mail Server" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: code:addons/google_gmail/models/google_gmail_mixin.py:72 | ||
#, python-format | ||
msgid "Only the administrator can link a Gmail mail server." | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: code:addons/google_gmail/models/google_gmail_mixin.py:75 | ||
#, python-format | ||
msgid "Please configure your Gmail credentials." | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_google_gmail_mixin__google_gmail_refresh_token | ||
#: model:ir.model.fields,field_description:google_gmail.field_ir_mail_server__google_gmail_refresh_token | ||
msgid "Refresh Token" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model_terms:ir.ui.view,arch_db:google_gmail.res_config_settings_view_form | ||
msgid "Send and receive email with your Gmail account." | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model_terms:ir.ui.view,arch_db:google_gmail.ir_mail_server_view_form | ||
msgid "Setup your Gmail API credentials in the general settings to link a Gmail account." | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,help:google_gmail.field_google_gmail_mixin__google_gmail_uri | ||
#: model:ir.model.fields,help:google_gmail.field_ir_mail_server__google_gmail_uri | ||
msgid "The URL to generate the authorization code from Google" | ||
msgstr "" | ||
|
||
#. module: google_gmail | ||
#: model:ir.model.fields,field_description:google_gmail.field_google_gmail_mixin__google_gmail_uri | ||
#: model:ir.model.fields,field_description:google_gmail.field_ir_mail_server__google_gmail_uri | ||
msgid "URI" | ||
msgstr "" | ||
|
Oops, something went wrong.