From b2ec55cc323c8008088466a45db80b95196aca8f Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Wed, 27 Jul 2022 06:11:59 +0000 Subject: [PATCH] [FIX] web: fix form view crash when notebook has name attribute Previously, when the name attribute was set on a notebook in a form view arch, we would pass that as a prop to the Notebook component, but this prop is not supported by the component, so it would crash in debug mode when validating the props. This commit fixes that by simply not copying this attribute to a prop as it is useless. closes odoo/odoo#96814 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/views/form/form_compiler.js | 7 +------ addons/web/static/tests/views/form/form_view_tests.js | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/views/form/form_compiler.js b/addons/web/static/src/views/form/form_compiler.js index d872d128145..0316e82beb9 100644 --- a/addons/web/static/src/views/form/form_compiler.js +++ b/addons/web/static/src/views/form/form_compiler.js @@ -421,7 +421,7 @@ export class FormCompiler extends ViewCompiler { const noteBookAnchors = {}; if (el.hasAttribute("class")) { - noteBook.setAttribute("className", `"${el.getAttribute("class")}"`); + noteBook.setAttribute("className", toStringExpression(el.getAttribute("class"))); el.removeAttribute("class"); } @@ -437,11 +437,6 @@ export class FormCompiler extends ViewCompiler { const pageSlot = createElement("t"); append(noteBook, pageSlot); - if (el.hasAttribute("name")) { - noteBook.setAttribute("name", `"${el.getAttribute("name")}"`); - el.removeAttribute("name"); - } - const pageId = `page_${this.id++}`; const pageTitle = toStringExpression( child.getAttribute("string") || child.getAttribute("name") || "" diff --git a/addons/web/static/tests/views/form/form_view_tests.js b/addons/web/static/tests/views/form/form_view_tests.js index 79110a22a8d..4f89ec4c527 100644 --- a/addons/web/static/tests/views/form/form_view_tests.js +++ b/addons/web/static/tests/views/form/form_view_tests.js @@ -916,7 +916,7 @@ QUnit.module("Views", (hooks) => {
- +