[FIX] web: returns right deferred when loading same xml twice in a row

Since commit 417a664f16:
The `ajax.loadXML` function has been refactored and improved so that
multiple calls to the function with the same URL only loads it once
and so that the deferred which is returned really indicates the status
of loading this particular URL.

Unfortunately, there was a mistake: when loading the same URL twice,
the second call always returned an already resolved deferred if the
first call to `ajax.loadXML` was done with this URL.
This commit is contained in:
qsm-odoo
2017-08-08 14:31:59 +02:00
parent cfdc76d758
commit 24c6e98685
+4 -1
View File
@@ -415,8 +415,11 @@ var loadXML = (function () {
if (loadingsData.length) {
// There is something to load, load it, resolve the associated
// deferred then start loading the next one
var loadingData = loadingsData.shift();
var loadingData = loadingsData[0];
loadingData.qweb.add_template(loadingData.url, function () {
// Remove from array only now so that multiple calls to
// loadXML with the same URL returns the right deferred
loadingsData.shift();
loadingData.def.resolve();
_load();
});