diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 90edb15b104..def1f3097e1 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -74,12 +74,11 @@ class google_docs(osv.osv): edit_url_template = 'https://docs.google.com/Edit?docid=%s' prefix_gdoc_id_res = DOCUMENT_LABEL + ':' - def copy_gdoc(self, cr, uid, model, folder=None, context=None): + def copy_gdoc(self, cr, uid, model, context=None): '''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity. @param cr: the current row from the database cursor. @param uid: the current user ID, for security checks. @param model: the current model name. - @param folder: folder in which to store the copy. @param context: a standard dictionary for contextual values. @return the url of the copy itself. @return -1 if the template hasn't been assigned yet. diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index e605577d45a..30edffaad7f 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -4,22 +4,22 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte on_attachments_loaded: function(attachments) { this._super(attachments); var self = this; - var $padbtn = self.$element.find('button.gdocs'); - var is_pad = function(a) { + var $gdocbtn = self.$element.find('button.gdocs'); + var is_gdoc = function(a) { return a.type == 'url' && a.name == 'GDocs'; }; - if (_.any(attachments, is_pad)) { - $padbtn.hide(); + if (_.any(attachments, is_gdoc)) { + $gdocbtn.hide(); } else { - $padbtn.show().click(self.on_add_pad); + $gdocbtn.show().click(self.on_add_gdoc); } }, - on_add_pad: function() { + on_add_gdoc: function() { var self = this; - var $padbtn = this.$element.find('button.gdocs'); - $padbtn.attr('disabled', 'true').find('img, span').toggle(); - this.view.dataset.call_button('pad_get', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { - $padbtn.hide(); + var $gdocbtn = this.$element.find('button.gdocs');alert($gdocbtn); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { + $gdocbtn.hide(); self.do_update(); self.do_action(r.result); }); diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index 52decbfdbc1..bc7a56842ba 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -4,7 +4,7 @@ -