From 025794704a0b9284d78045528c83196599fcd4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 31 May 2022 23:49:22 +0200 Subject: [PATCH] Replace usage of arguments in arrow function arguments is not available in arrow function so it is simpler to use rest parameters. issue11493 review419181003 --- src/common.js | 3 +-- src/screen.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common.js b/src/common.js index 7e6f041ce2..d01a1340e6 100644 --- a/src/common.js +++ b/src/common.js @@ -3975,8 +3975,7 @@ }; Sao.common.debounce = function(func, wait) { - return () => { - var args = [].slice(arguments); + return (...args) => { clearTimeout(func._debounceTimeout); func._debounceTimeout = setTimeout(() => { func.apply(this, args); diff --git a/src/screen.js b/src/screen.js index 8255c24787..3be222d0f2 100644 --- a/src/screen.js +++ b/src/screen.js @@ -1965,11 +1965,11 @@ (attributes.states || {})).pre_validate || []; prms.push(record.validate(fields, false, domain)); } - return jQuery.when.apply(jQuery, prms).then(() => { + return jQuery.when.apply(jQuery, prms).then((...args) => { var record; for (var i = 0; i < selected_records.length; i++) { record = selected_records[i]; - var result = arguments[i]; + var result = args[i]; if (result) { continue; }