diff options
| author | Amit Patel (OpenERP) <apa@tinyerp.com> | 2012-04-24 14:59:25 +0530 |
|---|---|---|
| committer | Amit Patel (OpenERP) <apa@tinyerp.com> | 2012-04-24 14:59:25 +0530 |
| commit | dfc4e3fb0979d76e47376680fbefc2a33e38bcd3 (patch) | |
| tree | 148f0e02cda3f890f40f0003d92334a44752e867 /addons/pad/static | |
| parent | c6bcc6d69fd7a1f8de0ad93baa642d5801b96a32 (diff) | |
| parent | e9f015e217f1ff48d95e9b55a9515b7276240c48 (diff) | |
[MERGE]
bzr revid: apa@tinyerp.com-20120417112722-7rz5vvcg6eo0jf3e
bzr revid: apa@tinyerp.com-20120419051214-j4wvjp9kz1w0zqs7
bzr revid: apa@tinyerp.com-20120423053400-unc6y6lonksopys3
bzr revid: apa@tinyerp.com-20120424092925-ezqfnppvfgocj94t
Diffstat (limited to 'addons/pad/static')
| -rw-r--r-- | addons/pad/static/src/js/pad.js | 27 | ||||
| -rw-r--r-- | addons/pad/static/src/xml/pad.xml | 8 |
2 files changed, 8 insertions, 27 deletions
diff --git a/addons/pad/static/src/js/pad.js b/addons/pad/static/src/js/pad.js index acc91f2273e..2e5f8820ac4 100644 --- a/addons/pad/static/src/js/pad.js +++ b/addons/pad/static/src/js/pad.js @@ -1,27 +1,16 @@ openerp.pad = 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.pad'); - var is_pad = function(a) { - return a.type == 'url' && a.name == 'Pad'; - }; - if (_.any(attachments, is_pad)) { - $padbtn.hide(); - } else { - $padbtn.show().click(self.on_add_pad); - } +instance.web.Sidebar = instance.web.Sidebar.extend({ + init: function(parent) { + this._super(parent); + this.add_items('other',[{ label: "Pad", callback: this.on_add_pad }]); }, on_add_pad: function() { var self = this; - var $padbtn = this.$element.find('button.pad'); - $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); + var view = this.getParent(); + var model = new instance.web.Model('ir.attachment'); + model.call('pad_get', [view.model ,view.datarecord.id],{}).then(function(r) { + self.do_action({ type: "ir.actions.act_url", url: r }); }); } }); diff --git a/addons/pad/static/src/xml/pad.xml b/addons/pad/static/src/xml/pad.xml index c17464e6646..e922294d03d 100644 --- a/addons/pad/static/src/xml/pad.xml +++ b/addons/pad/static/src/xml/pad.xml @@ -2,12 +2,4 @@ <!-- vim:fdl=1: --> <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 pad" type="button"> - <img src="/web/static/src/img/throbber.gif" width="16" height="16" style="display: none"/> - <span>Add Pad</span> - </button> - </t> - </t> </templates> |
