diff options
| author | Olivier Dony <odo@openerp.com> | 2011-10-28 13:33:57 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2011-10-28 13:33:57 +0200 |
| commit | 5fa1a6dd068c57ffda5d817ef7fceaa757caa5a0 (patch) | |
| tree | cb5f15d28447fad32aaab273a5e9055fe4c0ab2b /addons/edi/static/src/js | |
| parent | 000f3cad336cdf07fedea1153fa3b637f62cc419 (diff) | |
[IMP] edi: improve EDI preview sidebar
bzr revid: odo@openerp.com-20111028113357-ymc6amfurpyo17e9
Diffstat (limited to 'addons/edi/static/src/js')
| -rw-r--r-- | addons/edi/static/src/js/edi.js | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/addons/edi/static/src/js/edi.js b/addons/edi/static/src/js/edi.js index 859935ab9eb..d3cbc0486c0 100644 --- a/addons/edi/static/src/js/edi.js +++ b/addons/edi/static/src/js/edi.js @@ -36,25 +36,41 @@ openerp.edi.EdiView = openerp.web.Widget.extend({ console.log("sidebar",this.sidebar); this.$element.html(openerp.web.qweb.render("EdiView", param)); this.$element.find('button.oe_edi_action_print').bind('click', this.do_print); - this.$element.find('button.oe_edi_import_button').bind('click', this.do_import); + this.$element.find('button#oe_edi_import_existing').bind('click', this.do_import_existing); + this.$element.find('button#oe_edi_import_create').bind('click', this.do_import_create); + this.$element.find('button#oe_edi_download').bind('click', this.do_download); + this.$element.find('.oe_edi_import_choice, .oe_edi_import_choice_label').bind('click', this.toggle_choice); + this.$element.find('#oe_edi_download_show_code').bind('click', this.show_code); + }, + show_code: function($event) { + $('#oe_edi_download_code').show(); + return false; + }, + get_download_url: function() { + var l = window.location; + var url_prefix = l.protocol + '//' + l.host; + return url_prefix +'/edi/download?db=' + this.db + '&token=' + this.token; + }, + toggle_choice: function($e) { + $('.oe_edi_nested_block').hide(); + $('.'+$e.target.id+'_nested').show(); + return true; }, do_print: function(e){ var l = window.location; window.location = l.protocol + '//' + l.host + "/edi/download_attachment?db=" + this.db + "&token=" + this.token; }, - do_import: function(e){ - var l = window.location; - var url_prefix = l.protocol + '//' + l.host; - var url_download = url_prefix +'/edi/download?db=' + this.db + '&token=' + this.token; - - if (this.$element.find('#oe_edi_import_openerp').attr('checked') == 'checked') { - var server_url = this.$element.find('#oe_edi_txt_server_url').val() - window.location = 'http://' + server_url + '/edi/import_url?url=' + encodeURIComponent(url_download); - } else if (this.$element.find('#oe_edi_import_saas').attr('checked') == 'checked') { - window.location = "https://cc.my.openerp.com/odms/create_edi?url=" + encodeURIComponent(url_download); - } else if (this.$element.find('#oe_edi_import_download').attr('checked') == 'checked') { - window.location = url_download - } + do_import_existing: function(e) { + var url_download = this.get_download_url(); + var server_url = this.$element.find('#oe_edi_txt_server_url').val() + window.location = 'http://' + server_url + '/edi/import_url?url=' + encodeURIComponent(url_download); + }, + do_import_create: function(e){ + var url_download = this.get_download_url(); + window.location = "https://cc.my.openerp.com/odms/create_edi?url=" + encodeURIComponent(url_download); + }, + do_download: function(e){ + window.location = this.get_download_url(); } }); |
