From 08e37a27580d8322311dd8f27c082293ca7548b9 Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Thu, 1 Nov 2012 12:48:46 +0530 Subject: [IMP]: meaningful google doc name and newly created google document open in new tab. bzr revid: tta@openerp.com-20121101071846-i9k3jfa8bdzfwvu9 --- addons/google_docs/google_docs.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'addons/google_docs/google_docs.py') diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index c1139b2eb5a..901ba17da3d 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -17,7 +17,7 @@ # along with this program. If not, see . # ############################################################################## - +from datetime import datetime from osv import osv, fields from tools.translate import _ try: @@ -61,7 +61,7 @@ class google_docs_ir_attachment(osv.osv): #login with the base account google module client = self._auth(cr, uid, context=context) # create the document in google docs - title = context.get("name","Untitled Document.") + title = "%s %s" % (context.get("name","Untitled Document."), datetime.today().strftime("%Y-%m-%d %H:%M:%S")) local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL,title=title) #create a new doc in Google Docs gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/') @@ -70,10 +70,12 @@ class google_docs_ir_attachment(osv.osv): 'res_model': res_model, 'res_id': res_id, 'type': 'url', - 'name': _('Google Doc'), + 'name': title, 'url': gdocs_resource.get_alternate_link().href, }, context=context) - return gdocs_resource.resource_id.text + return {'resource_id': gdocs_resource.resource_id.text, + 'title': title, + 'url': gdocs_resource.get_alternate_link().href} def copy_gdoc(self, cr, uid, res_model, res_id, name_gdocs, gdoc_template_id, context=None): ''' -- cgit v1.2.3