[FIX] google_drive: google_drive_refresh_token
When saving the settings, the `google_drive_refresh_token` is never set. This is due to the `ir.config_parameter` which was retrieved after being saved. opw-1882068
This commit is contained in:
committed by
Nicolas Martinelli
parent
de1b97f493
commit
a8950a9e8f
@@ -17,10 +17,11 @@ class ResConfigSettings(models.TransientModel):
|
||||
config.google_drive_uri = google_drive_uri
|
||||
|
||||
def set_values(self):
|
||||
super(ResConfigSettings, self).set_values()
|
||||
params = self.env['ir.config_parameter'].sudo()
|
||||
authorization_code_before = params.get_param('google_drive_authorization_code')
|
||||
super(ResConfigSettings, self).set_values()
|
||||
authorization_code = self.google_drive_authorization_code
|
||||
refresh_token = False
|
||||
if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'):
|
||||
if authorization_code and authorization_code != authorization_code_before:
|
||||
refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code)
|
||||
params.set_param('google_drive_refresh_token', refresh_token)
|
||||
|
||||
Reference in New Issue
Block a user