[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) <aab@odoo.com>
This commit is contained in:
Samuel Degueldre
2022-07-28 03:51:08 +02:00
parent 11572f0f20
commit b2ec55cc32
2 changed files with 2 additions and 7 deletions
@@ -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") || ""
@@ -916,7 +916,7 @@ QUnit.module("Views", (hooks) => {
<form>
<sheet>
<field name="int_field"/>
<notebook class="new_class" attrs='{"invisible": [["int_field", "=", 10]]}'>
<notebook name="test_name" class="new_class" attrs='{"invisible": [["int_field", "=", 10]]}'>
<page string="Foo">
<field name="foo"/>
</page>