[FIX] edi connection setup

bzr revid: al@openerp.com-20111219142550-z68rdsszavf8sikc
This commit is contained in:
Antony Lesuisse 2011-12-19 15:25:50 +01:00
parent 49823622de
commit bc3815e26e
1 changed files with 10 additions and 8 deletions

View File

@ -9,15 +9,16 @@ openerp.edi.EdiView = openerp.web.Widget.extend({
this._super();
this.db = db;
this.token = token;
this.session = new openerp.web.Connection();
this.session = openerp.connection;
this.template = "EdiEmpty";
this.content = "";
this.sidebar = "";
},
start: function() {
this._super();
var self = this;
var param = {"db": this.db, "token": this.token};
this.rpc('/edi/get_edi_document', param, this.on_document_loaded, this.on_document_failed);
this.session.bind().then(self.rpc('/edi/get_edi_document', param, this.on_document_loaded, this.on_document_failed));
},
on_document_loaded: function(docs){
this.doc = docs[0];
@ -116,17 +117,18 @@ openerp.edi.EdiImport = openerp.web.Widget.extend({
var params = {};
this.template = "EdiImport";
this.session = new openerp.web.Connection();
this.session = openerp.connection;
this.login = new openerp.web.Login(this);
this.header = new openerp.web.Header(this);
this.header.on_logout.add(this.login.on_logout);
},
start: function() {
this.session.on_session_invalid.add_last(this.do_ask_login)
this.session.on_session_valid.add_last(this.do_import);
this.header.appendTo($("#oe_header"));
this.session.start();
this.login.appendTo($('#oe_login'));
this.session.bind().then(function() {
this.session.on_session_invalid.add_last(this.do_ask_login)
this.header.appendTo($("#oe_header"));
this.login.appendTo($('#oe_login'));
this.do_import();
});
},
do_ask_login: function() {
this.login.do_ask_login(this.do_import);