diff options
| author | Roberto López López (OpenERP) <rlo@openerp.com> | 2012-02-27 13:38:34 +0100 |
|---|---|---|
| committer | Roberto López López (OpenERP) <rlo@openerp.com> | 2012-02-27 13:38:34 +0100 |
| commit | 37ed7a1d9f1819fd39cbf0eb0679ae17e1afd91a (patch) | |
| tree | 071920dbb3f84175667dc17cba07d14b42980c7f | |
| parent | cea3437f596f73558e23f1e67d61029daccf8d6f (diff) | |
[imp] view
bzr revid: rlo@openerp.com-20120227123834-todar214ngca7pu0
| -rw-r--r-- | addons/google_docs/google_docs.py | 3 | ||||
| -rw-r--r-- | addons/google_docs/static/src/js/gdocs.js | 20 | ||||
| -rw-r--r-- | addons/google_docs/static/src/xml/gdocs.xml | 2 |
3 files changed, 12 insertions, 13 deletions
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 @@ <templates id="template" xml:space="preserve"> <t t-extend="FormView.sidebar.attachments"> <t t-jquery="div.oe-binary-file-set" t-operation="append"> - <button class="button gdoc" type="button"> + <button class="oe_button" type="button"> <img src="/web/static/src/img/throbber.gif" width="16" height="16" style="display: none"/> <span>Add GDoc</span> </button> |
