diff options
| author | Roberto López López (OpenERP) <rlo@openerp.com> | 2012-02-27 10:02:24 +0100 |
|---|---|---|
| committer | Roberto López López (OpenERP) <rlo@openerp.com> | 2012-02-27 10:02:24 +0100 |
| commit | ebfb0be2e156b49a14790300ce746dba78a159d5 (patch) | |
| tree | 227bc5201715c14d4b51b80a2010f6fbb208cdcf /addons/google_docs/static/src/js | |
| parent | fd914eb2e3e09fec08733989e5c8456d4516194a (diff) | |
[IMP] copy from pad
bzr revid: rlo@openerp.com-20120227090224-zujpg9zhf2nd5ioe
Diffstat (limited to 'addons/google_docs/static/src/js')
| -rw-r--r-- | addons/google_docs/static/src/js/gdocs.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js new file mode 100644 index 00000000000..e605577d45a --- /dev/null +++ b/addons/google_docs/static/src/js/gdocs.js @@ -0,0 +1,29 @@ +openerp.gdocs = function(instance) { + +instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ + on_attachments_loaded: function(attachments) { + this._super(attachments); + var self = this; + var $padbtn = self.$element.find('button.gdocs'); + var is_pad = function(a) { + return a.type == 'url' && a.name == 'GDocs'; + }; + if (_.any(attachments, is_pad)) { + $padbtn.hide(); + } else { + $padbtn.show().click(self.on_add_pad); + } + }, + on_add_pad: 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(); + self.do_update(); + self.do_action(r.result); + }); + } +}); + +}; |
