[IMP] Moved Google Authorization Code to General Setting
bzr revid: pga@tinyerp.com-20130523133848-0i3j6h3rzj5a66pd
This commit is contained in:
parent
5b9b00631d
commit
ba97e0cdc2
|
@ -202,8 +202,8 @@ class config(osv.osv):
|
||||||
|
|
||||||
config()
|
config()
|
||||||
|
|
||||||
class res_users(osv.osv):
|
class base_config_settings(osv.osv):
|
||||||
_inherit = "res.users"
|
_inherit = "base.config.settings"
|
||||||
|
|
||||||
def onchange_authorization_code(self, cr, uid, ids, authorization_code, context=None):
|
def onchange_authorization_code(self, cr, uid, ids, authorization_code, context=None):
|
||||||
res = {}
|
res = {}
|
||||||
|
@ -222,7 +222,16 @@ class res_users(osv.osv):
|
||||||
if 'refresh_token' in content.keys():
|
if 'refresh_token' in content.keys():
|
||||||
ir_config.set_param(cr, uid, 'google_refresh_token', content['refresh_token'])
|
ir_config.set_param(cr, uid, 'google_refresh_token', content['refresh_token'])
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def get_default_authorization_code(self, cr, uid, ids, context=None):
|
||||||
|
authorization_code = self.pool.get("ir.config_parameter").get_param(cr, uid, "authorization_code", context=context)
|
||||||
|
return {'authorization_code': authorization_code}
|
||||||
|
|
||||||
|
def set_authorization_code(self, cr, uid, ids, context=None):
|
||||||
|
config_parameters = self.pool.get("ir.config_parameter")
|
||||||
|
for record in self.browse(cr, uid, ids, context=context):
|
||||||
|
config_parameters.set_param(cr, uid, "authorization_code", record.authorization_code or '', context=context)
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'authorization_code': fields.char('Authorization Code', size=124),
|
'authorization_code': fields.char('Google Authorization Code', size=124),
|
||||||
}
|
}
|
|
@ -22,5 +22,9 @@
|
||||||
<field name="value">-</field>
|
<field name="value">-</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="config_authorization_code" model="ir.config_parameter">
|
||||||
|
<field name="key">authorization_code</field>
|
||||||
|
<field name="value">-</field>
|
||||||
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
|
@ -76,19 +76,7 @@
|
||||||
<xpath expr="//div[@name='google_docs']" position="after">
|
<xpath expr="//div[@name='google_docs']" position="after">
|
||||||
<div attrs="{'invisible': [('module_google_docs','=',False)]}">
|
<div attrs="{'invisible': [('module_google_docs','=',False)]}">
|
||||||
<button type="action" name="%(google_docs.action_google_docs_users_config)d" string="Configure Template" class="oe_link" />
|
<button type="action" name="%(google_docs.action_google_docs_users_config)d" string="Configure Template" class="oe_link" />
|
||||||
</div>
|
<group >
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="view_users_gogole_form" model="ir.ui.view">
|
|
||||||
<field name="name">res.users.google.form1</field>
|
|
||||||
<field name="model">res.users</field>
|
|
||||||
<field name="inherit_id" ref="base.view_users_form"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//notebook" position="inside">
|
|
||||||
<page string="Google Authorization Code" attrs="{'invisible': [('id', '!=', 1)]}">
|
|
||||||
<group string="Google Authorization Code">
|
|
||||||
<group >
|
<group >
|
||||||
<field name="authorization_code" on_change="onchange_authorization_code(authorization_code)"/>
|
<field name="authorization_code" on_change="onchange_authorization_code(authorization_code)"/>
|
||||||
</group>
|
</group>
|
||||||
|
@ -96,20 +84,7 @@
|
||||||
<a href="https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/drive&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=39623646228-eg3ggo3mk6o40m7rguobi3rkl9frh4tb.apps.googleusercontent.com" target="_blank" class="oe_link"><b>Generate Authorization Code</b></a>
|
<a href="https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/drive&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=39623646228-eg3ggo3mk6o40m7rguobi3rkl9frh4tb.apps.googleusercontent.com" target="_blank" class="oe_link"><b>Generate Authorization Code</b></a>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</page>
|
</div>
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
<record id="view_users_gogole_preference" model="ir.ui.view">
|
|
||||||
<field name="name">res.users.google.form2</field>
|
|
||||||
<field name="model">res.users</field>
|
|
||||||
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//group[@name='preferences']" position="after">
|
|
||||||
<group string="Google Account" attrs="{'invisible': [('id', '!=', 1)]}">
|
|
||||||
<field name="authorization_code" on_change="onchange_authorization_code(authorization_code)"/>
|
|
||||||
<a href="https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/drive&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=39623646228-eg3ggo3mk6o40m7rguobi3rkl9frh4tb.apps.googleusercontent.com" target="_blank" class="oe_link"><b>Generate Authorization Code</b></a>
|
|
||||||
</group>
|
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue