From a8950a9e8fe7cb646f444714ccabd85180798d78 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 13 Sep 2018 15:48:37 +0200 Subject: [PATCH] [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 --- addons/google_drive/models/res_config_settings.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/google_drive/models/res_config_settings.py b/addons/google_drive/models/res_config_settings.py index a4414fe7f32..f2175d27e57 100644 --- a/addons/google_drive/models/res_config_settings.py +++ b/addons/google_drive/models/res_config_settings.py @@ -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)