summaryrefslogtreecommitdiff
path: root/addons/google_docs/google_docs.py
diff options
context:
space:
mode:
authorTejas Tank <tta@openerp.com>2012-11-01 12:48:46 +0530
committerTejas Tank <tta@openerp.com>2012-11-01 12:48:46 +0530
commit08e37a27580d8322311dd8f27c082293ca7548b9 (patch)
tree878a8022d49f946683afb404a9447ac004a58b17 /addons/google_docs/google_docs.py
parent596e419fe789e4204575adfc0c84055641a62503 (diff)
[IMP]: meaningful google doc name and newly created google document open in new tab.
bzr revid: tta@openerp.com-20121101071846-i9k3jfa8bdzfwvu9
Diffstat (limited to 'addons/google_docs/google_docs.py')
-rw-r--r--addons/google_docs/google_docs.py10
1 files changed, 6 insertions, 4 deletions
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 <http://www.gnu.org/licenses/>.
#
##############################################################################
-
+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):
'''