Skip to content

Commit

Permalink
[FIX] google_gmail: do not copy the authorization code
Browse files Browse the repository at this point in the history
Bug
===
When we copy a GMail outgoing / incoming mail server, an error
occurs because we try to refetch the access token, based on the same
authorization code (which can be used only once).

To fix this issue, we do not copy the authorization code (and other
related fields).

Task-2751996

X-original-commit: 2879976
Part-of: #87294
  • Loading branch information
std-odoo committed Mar 29, 2022
1 parent 4289887 commit 444fffe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions addons/google_gmail/models/google_gmail_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class GoogleGmailMixin(models.AbstractModel):
_SERVICE_SCOPE = 'https://mail.google.com/'

use_google_gmail_service = fields.Boolean('Gmail Authentication')
google_gmail_authorization_code = fields.Char(string='Authorization Code', groups='base.group_system')
google_gmail_refresh_token = fields.Char(string='Refresh Token', groups='base.group_system')
google_gmail_access_token = fields.Char(string='Access Token', groups='base.group_system')
google_gmail_access_token_expiration = fields.Integer(string='Access Token Expiration Timestamp', groups='base.group_system')
google_gmail_authorization_code = fields.Char(string='Authorization Code', groups='base.group_system', copy=False)
google_gmail_refresh_token = fields.Char(string='Refresh Token', groups='base.group_system', copy=False)
google_gmail_access_token = fields.Char(string='Access Token', groups='base.group_system', copy=False)
google_gmail_access_token_expiration = fields.Integer(string='Access Token Expiration Timestamp', groups='base.group_system', copy=False)
google_gmail_uri = fields.Char(compute='_compute_gmail_uri', string='URI', help='The URL to generate the authorization code from Google', groups='base.group_system')

@api.depends('google_gmail_authorization_code')
Expand Down

0 comments on commit 444fffe

Please sign in to comment.