From 9b01bacd2e569e0d1a6dd8264dbae7d70f41c7c3 Mon Sep 17 00:00:00 2001 From: AdhamElsabbagh Date: Thu, 12 Sep 2024 16:02:06 +0200 Subject: [PATCH] Update static_list.esm.js fix this error https://www.odoo.com/fr_FR/forum/aide-1/odd-occurence-on-my-odoo-v17-instance-self-hosted-261350 --- .../static/src/js/static_list.esm.js | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/server_action_mass_edit/static/src/js/static_list.esm.js b/server_action_mass_edit/static/src/js/static_list.esm.js index 1a751b5424..a6e5a10c70 100644 --- a/server_action_mass_edit/static/src/js/static_list.esm.js +++ b/server_action_mass_edit/static/src/js/static_list.esm.js @@ -9,25 +9,29 @@ patch(StaticList.prototype, { this._onUpdate = options.onUpdate; this._cache = markRaw({}); - this._commands = []; - this._initialCommands = []; + this._commands = this._commands || []; + console.log("Initial Commands:", this._commands); + this._savePoint = undefined; this._unknownRecordCommands = {}; this._currentIds = [...this.resIds]; - this._initialCurrentIds = [...this.currentIds]; this._needsReordering = false; this._tmpIncreaseLimit = 0; this._extendedRecords = new Set(); - // To prevent the TypeError: data.slice is not a function" while set/remove/add - // value in wizard - this.records = Array.isArray(data) - ? data - .slice(this.offset, this.limit) - .map((r) => this._createRecordDatapoint(r)) - : []; + + const safeData = Array.isArray(data) ? data : []; + this.records = safeData.slice(this.offset, this.limit).map((r) => this._createRecordDatapoint(r)); + this.count = this.resIds.length; this.handleField = Object.keys(this.activeFields).find( (fieldName) => this.activeFields[fieldName].isHandle ); }, + + _applyCommands() { + console.log("Applying Commands:", this._commands); + // Add logic here to ensure commands is iterable + this._commands = this._commands || []; + // Further code... + } });