From 2d242b1ed9f03a765f17f6cbdef39ff259698202 Mon Sep 17 00:00:00 2001
From: Laurent Smet <las@odoo.com>
Date: Mon, 8 Oct 2018 08:52:05 +0000
Subject: [PATCH] [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
---
 .../static/src/js/reconciliation/reconciliation_model.js  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js
index fcfc5f35ab7d..cff4d7b91bec 100644
--- a/addons/account/static/src/js/reconciliation/reconciliation_model.js
+++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js
@@ -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);
-- 
GitLab