[IMP] Added alert, Changed logo

bzr revid: pga@tinyerp.com-20130529070723-ruz42rqh798h4w0a
This commit is contained in:
Parth Gajjar (Open ERP)
2013-05-29 12:37:23 +05:30
parent ffcc15c7e1
commit 0fec1053f3
4 changed files with 19 additions and 14 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
##############################################################################
{
'name': 'Google Drive integration',
'name': 'Google Drive™ integration',
'version': '0.2',
'author': 'OpenERP SA',
'website': 'http://openerp.com',
+17 -12
View File
@@ -84,18 +84,23 @@ class config(osv.osv):
content = json.loads(content)
# Copy template in to drive with help of new access token
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
record_url = "Click on link to open Record in OpenERP\n %s/?db=%s#id=%s&model=%s" %(google_web_base_url, cr.dbname, res_id, res_model )
data = {"title": name_gdocs, "description": record_url}
request_url = "https://www.googleapis.com/drive/v2/files/%s/copy?access_token=%s" % (tamplate_id, content['access_token'])
resp, content = Http().request(request_url, "POST", json.dumps(data), headers)
content = json.loads(content)
res = False
if 'alternateLink' in content.keys():
attach_pool = self.pool.get("ir.attachment")
attach_vals = {'res_model': res_model, 'name': name_gdocs, 'res_id': res_id, 'type': 'url', 'url':content['alternateLink']}
attach_pool.create(cr, uid, attach_vals)
res = content['alternateLink']
if content.has_key('access_token'):
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
record_url = "Click on link to open Record in OpenERP\n %s/?db=%s#id=%s&model=%s" %(google_web_base_url, cr.dbname, res_id, res_model )
data = {"title": name_gdocs, "description": record_url}
request_url = "https://www.googleapis.com/drive/v2/files/%s/copy?access_token=%s" % (tamplate_id, content['access_token'])
resp, content = Http().request(request_url, "POST", json.dumps(data), headers)
content = json.loads(content)
res = False
if 'alternateLink' in content.keys():
attach_pool = self.pool.get("ir.attachment")
attach_vals = {'res_model': res_model, 'name': name_gdocs, 'res_id': res_id, 'type': 'url', 'url':content['alternateLink']}
attach_pool.create(cr, uid, attach_vals)
res = content['alternateLink']
elif uid==1:
raise self.pool.get('res.config.settings').get_config_warning(cr, _("You haven't configured 'Authorization Code' generated from google, Please generate and configure it in %%(menu:base_setup.menu_general_configuration)s."), context=context)
else:
raise osv.except_osv(_('Google Drive Configuration Error!'), _("'Authorization Code' is not configured yet, Please Contact Administrator"))
return res
def get_google_docs_config(self, cr, uid, res_model, res_id, context=None):
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 19 KiB

+1 -1
View File
@@ -34,7 +34,7 @@ openerp.google_docs = function (instance, m) {
self.items.other.splice(g_item, 1);
}
self.add_items('other', [{
label: res.name+ '<img style="height:20px;width:20px;float:right;" src="google_docs/static/src/img/drive_icon.png"/>',
label: res.name+ '<img style="position:absolute;right:5px;height:20px;width:20px;" title="Google Drive" src="google_docs/static/src/img/drive_icon.png"/>',
config_id: res.id,
res_id: res_id,
res_model: view.dataset.model,