openerp.edi = function(instance) { var _t = instance.web._t; instance.edi = {}; instance.edi.EdiImport = instance.web.Widget.extend({ init: function(parent,url) { this._super(); this.url = url; }, start: function() { if (!this.session.session_is_valid()) { instance.redirect('/web/login?redir=' + encodeURIComponent(window.location)); } else { this.show_import(); } }, show_import: function() { this.destroy_content(); this.do_import(); }, destroy_content: function() { _.each(_.clone(this.getChildren()), function(el) { el.destroy(); }); this.$el.children().remove(); }, do_import: function() { this.rpc('/edi/import_edi_url', {url: this.url}).done(this.on_imported).fail(this.on_imported_error); }, on_imported: function(response) { if ('action' in response) { this.rpc("/web/session/save_session_action", {the_action: response.action}).done(function(key) { window.location = "/#sa="+encodeURIComponent(key); }); } else { new instance.web.Dialog(this,{ title: 'Import Successful!', buttons: { Ok: function() { this.parents('.modal').modal('hide'); window.location = "/"; } } },$('