diff options
| author | Tejas Tank <tta@openerp.com> | 2012-11-01 12:48:46 +0530 |
|---|---|---|
| committer | Tejas Tank <tta@openerp.com> | 2012-11-01 12:48:46 +0530 |
| commit | 08e37a27580d8322311dd8f27c082293ca7548b9 (patch) | |
| tree | 878a8022d49f946683afb404a9447ac004a58b17 /addons/google_docs | |
| parent | 596e419fe789e4204575adfc0c84055641a62503 (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')
| -rw-r--r-- | addons/google_docs/google_docs.py | 10 | ||||
| -rw-r--r-- | addons/google_docs/static/src/js/gdocs.js | 1 |
2 files changed, 7 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): ''' diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 6e8ff59f377..3a14e1f4ad6 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -30,6 +30,7 @@ var _t = instance.web._t, }); } }).done(function(){ + window.open(r.url,"_blank"); view.reload(); }); }); |
