From e47bc1115fabae1841471999e0aa56711b9b09ac Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Fri, 7 Jul 2023 11:29:41 +0000 Subject: [PATCH] [FIX] web_editor: prevent traceback on convert single-col align stretch When converting a row with items that are supposed to be stretch-aligned we need to set each of its column's height. However this failed when the row contained less than two columns. opw-3371134 closes odoo/odoo#127813 X-original-commit: 7df4cc0d9aaccf0dabcc4a7863549b276efaa403 Signed-off-by: David Monjoie (dmo) --- .../web_editor/static/src/js/backend/convert_inline.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/web_editor/static/src/js/backend/convert_inline.js b/addons/web_editor/static/src/js/backend/convert_inline.js index d2f8c0a38c5..074350f40ca 100644 --- a/addons/web_editor/static/src/js/backend/convert_inline.js +++ b/addons/web_editor/static/src/js/backend/convert_inline.js @@ -980,10 +980,12 @@ function formatTables($editable) { row.style.verticalAlign = 'bottom'; } else if (alignItems === 'stretch') { const columns = [...row.querySelectorAll('td.o_converted_col')]; - const commonAncestor = commonParentGet(columns[0], columns[1]); - const biggestHeight = commonAncestor.clientHeight; - for (const column of columns) { - column.style.height = biggestHeight + 'px'; + if (columns.length > 1) { + const commonAncestor = commonParentGet(columns[0], columns[1]); + const biggestHeight = commonAncestor.clientHeight; + for (const column of columns) { + column.style.height = biggestHeight + 'px'; + } } } }