[IMP] abort FAYT requests when the next one comes in

bzr revid: xmo@openerp.com-20131113151832-ym4hvpyhn5t7ocxs
This commit is contained in:
Xavier Morel
2013-11-13 16:18:32 +01:00
parent 6562ab4d76
commit 837aa436e5
@@ -845,8 +845,9 @@
}),
init: function (editor) {
this._super(editor);
// url -> name mapping for existing pages
this.text = null;
// Store last-performed request to be able to cancel/abort it.
this.req = null;
},
start: function () {
var self = this;
@@ -941,7 +942,9 @@
.addBack().removeClass('has-error');
},
fetch_pages: function (term) {
return openerp.jsonRpc('/web/dataset/call_kw', 'call', {
var self = this;
if (this.req) { this.req.abort(); }
return this.req = openerp.jsonRpc('/web/dataset/call_kw', 'call', {
model: 'website',
method: 'search_pages',
args: [null, term],
@@ -949,6 +952,9 @@
limit: 9,
context: website.get_context()
},
}).done(function () {
// request completed successfully -> unstore it
self.req = null;
});
},
});