From 06141c34a5960be9315b8c6393a1ec3b71e92588 Mon Sep 17 00:00:00 2001 From: fwi-odoo Date: Mon, 12 Jun 2017 13:53:19 +0200 Subject: [PATCH] [FIX] auth_oauth: don't assume that google and facebook providers always exist Before this commit, it was not possible to reach the general settings when one of the "default" provider was delete. After this commit, we don't assume anymore that there are google and facebook providers. opw-746907 --- addons/auth_oauth/res_config.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/auth_oauth/res_config.py b/addons/auth_oauth/res_config.py index de5f1a74b2d..09c48922415 100644 --- a/addons/auth_oauth/res_config.py +++ b/addons/auth_oauth/res_config.py @@ -45,10 +45,10 @@ class base_config_settings(osv.TransientModel): rg = self.pool.get('auth.oauth.provider').read(cr, uid, [google_id], ['enabled','client_id'], context=context) rf = self.pool.get('auth.oauth.provider').read(cr, uid, [facebook_id], ['enabled','client_id'], context=context) return { - 'auth_oauth_google_enabled': rg[0]['enabled'], - 'auth_oauth_google_client_id': rg[0]['client_id'], - 'auth_oauth_facebook_enabled': rf[0]['enabled'], - 'auth_oauth_facebook_client_id': rf[0]['client_id'], + 'auth_oauth_google_enabled': rg[0]['enabled'] if rg else False, + 'auth_oauth_google_client_id': rg[0]['client_id'] if rg else False, + 'auth_oauth_facebook_enabled': rf[0]['enabled'] if rf else False, + 'auth_oauth_facebook_client_id': rf[0]['client_id'] if rf else False, } def set_oauth_providers(self, cr, uid, ids, context=None):