[FIX] auth_oauth: reset openerp oauth client_id when generating new dbuuid

bzr revid: chs@openerp.com-20140305114110-ym3c0x3muc34ep7b
This commit is contained in:
Christophe Simonis 2014-03-05 12:41:10 +01:00
parent b54b8681a0
commit 2ab0441ec2
2 changed files with 15 additions and 0 deletions

View File

@ -2,3 +2,4 @@ import controllers
import auth_oauth
import res_users
import res_config
import ir_configparameter

View File

@ -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})