[FIX] account: fix $.when(defs) in reconciliation widget

Introduced by: https://github.com/odoo/odoo/commit/b0a29c9bad4fb9180ddcdae80529e244c6b61d49

Suppose def1, def2, def3, three deferred.
$.when(def1, def2, def3) is ok
$.when([def1, def2, def3]) is not ok
$.when.apply($, [def1, def2, def3]) is ok

closes odoo/odoo#27513
This commit is contained in:
Laurent Smet
2018-10-08 09:06:24 +00:00
parent d4d820f0bb
commit 2d242b1ed9
@@ -510,13 +510,15 @@ var StatementModel = BasicModel.extend({
line.mode = (id || line.mode !== "create") && isNaN(id) && !this.avoidCreate ? 'create' : 'match';
defs.push(this._computeLine(line));
if (line.mode === 'create') {
return $.when(defs).then(function () {
return $.when.apply($, defs).then(function () {
return self.createProposition(handle);
});
} else if (line.mode === 'match') {
return $.when(defs, self._performMoveLine(handle));
return $.when.apply($, defs).then(function () {
return self._performMoveLine(handle);
});
}
return $.when(defs);
return $.when.apply($, defs);
},
searchBalanceAmount: function (handle) {
var line = this.getLine(handle);