diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js index 70ea31aab01..1f7bf20b79c 100644 --- a/addons/web/static/src/js/views/list/list_editable_renderer.js +++ b/addons/web/static/src/js/views/list/list_editable_renderer.js @@ -640,6 +640,18 @@ ListRenderer.include({ } return $borderDataRow; }, + /** + * Compute the sum of the weights for each columns, excluding + * those with an absolute width. param `$thread` is useful for studio, in + * order to show column hooks. + * + * @private + * @param {jQuery} $thead + * @return {integer} + */ + _getColumnsTotalWidth($thead) { + return this.columns.reduce((acc, column) => acc + (column.attrs.relativeWidth || 0), 0); + }, /** * Returns the width of a column according the 'width' attribute set in the * arch, the widget or the field type. A fixed width is harcoded for some @@ -1053,11 +1065,7 @@ ListRenderer.include({ if (!this.columnWidths) { if (!this._hasVisibleRecords(this.state)) { - // we compute the sum of the weights for each columns, excluding - // those with an absolute width. - var totalWidth = this.columns.reduce(function (acc, column) { - return acc + (column.attrs.relativeWidth || 0); - }, 0); + var totalWidth = this._getColumnsTotalWidth($thead); this.columns.forEach(function (column) { let width; if (column.attrs.absoluteWidth) {