From 2ab0441ec2778be349bc312f967a60a9d06bce48 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 5 Mar 2014 12:41:10 +0100 Subject: [PATCH] [FIX] auth_oauth: reset openerp oauth client_id when generating new dbuuid bzr revid: chs@openerp.com-20140305114110-ym3c0x3muc34ep7b --- addons/auth_oauth/__init__.py | 1 + addons/auth_oauth/ir_configparameter.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 addons/auth_oauth/ir_configparameter.py diff --git a/addons/auth_oauth/__init__.py b/addons/auth_oauth/__init__.py index a56db75633b..08c1dd3d6b5 100644 --- a/addons/auth_oauth/__init__.py +++ b/addons/auth_oauth/__init__.py @@ -2,3 +2,4 @@ import controllers import auth_oauth import res_users import res_config +import ir_configparameter diff --git a/addons/auth_oauth/ir_configparameter.py b/addons/auth_oauth/ir_configparameter.py new file mode 100644 index 00000000000..b0fa17ffa5b --- /dev/null +++ b/addons/auth_oauth/ir_configparameter.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +from openerp import SUPERUSER_ID +from openerp.osv import osv + +class ir_configparameter(osv.Model): + _inherit = 'ir.config_parameter' + + def init(self, cr, force=False): + super(ir_configparameter, self).init(cr, force=force) + if force: + IMD = self.pool['ir.model.data'] + oauth_oe = IMD.xmlid_to_object(cr, SUPERUSER_ID, 'auth_oauth.provider_openerp') + dbuuid = self.get_param(cr, SUPERUSER_ID, 'database.uuid') + oauth_oe.write({'client_id': dbuuid})