[FIX]google_drive, google_spreadsheet: move of get_google_scope in google objects instead of config

bzr revid: dle@openerp.com-20130724153754-thj2l0b1t4lw136j
This commit is contained in:
Denis Ledoux 2013-07-24 17:37:54 +02:00
parent 54de4095ae
commit f3e189698d
2 changed files with 8 additions and 11 deletions

View File

@ -204,21 +204,21 @@ class config(osv.osv):
(_check_model_id, 'Model of selected filter is not matching with model of current template.', ['model_id', 'filter_id']),
]
def get_google_scope(self):
return 'https://www.googleapis.com/auth/drive'
config()
class base_config_settings(osv.osv):
_inherit = "base.config.settings"
def _get_google_scope(self):
return 'https://www.googleapis.com/auth/drive'
_columns = {
'google_drive_authorization_code': fields.char('Authorization Code', size=124),
'google_drive_uri': fields.char('URI', readonly=True, help="The URL to generate the authorization code from Google"),
}
_defaults = {
'google_drive_uri': lambda s, cr, uid, c: s.pool['google.service']._get_google_token_uri(cr, uid, 'drive', scope=s._get_google_scope(), context=c),
'google_drive_uri': lambda s, cr, uid, c: s.pool['google.service']._get_google_token_uri(cr, uid, 'drive', scope=s.pool['google.drive.config'].get_google_scope(), context=c),
}
def set_google_authorization_code(self, cr, uid, ids, context=None):

View File

@ -27,16 +27,13 @@ from openerp.osv import osv
from openerp import SUPERUSER_ID
class base_config_settings(osv.osv):
_inherit = "base.config.settings"
def _get_google_scope(self):
return 'https://www.googleapis.com/auth/drive https://spreadsheets.google.com/feeds'
class config(osv.osv):
_inherit = 'google.drive.config'
def get_google_scope(self):
scope = super(config, self).get_google_scope()
return '%s https://spreadsheets.google.com/feeds' % scope
def write_config_formula(self, cr, uid, attachment_id, spreadsheet_key, model, domain, groupbys, view_id, context=None):
access_token = self.get_access_token(cr, uid, scope='https://spreadsheets.google.com/feeds', context=context)