odoo/odoo#191750

Created by fw-bot
Merged at de65cf2e56b2ae8e2341e39d252d2f1786794af9

Statuses:

label
odoo-dev:saas-18.1-16.0-fix-clone-add-tab-seba-l_rb-fw
head
91f4d56e312422660197b666548ca98684ed4c8d
merged
9 months ago by Website, Serge Bayet (seba)
odoo/odoo
16.0 #190460
17.0 #191672
saas-17.2 #191698
saas-17.4 #191709
18.0 #191747
saas-18.1 #191750
saas-18.2
saas-18.3
saas-18.4
19.0
master #191751

[FW][FIX] website: prevent traceback when adding a tab containing a form

Since 1, a fix was introduced to display the actual value of a relational field instead of its ID. However, another issue occurs when a form is inside a tab (Tabs snippet) and a new tab is added. During this process, the currently active tab is cloned, including its field IDs. Although a method exists to update the IDs after cloning, the form rendering is triggered beforehand.

This causes the labels property of input elements—which is expected to return a NodeList of associated <label> elements—to fail because the cloned input IDs are not unique.

This commit resolves the issue by using querySelector to target the associated label elements directly.

Steps to reproduce:

  • Open the Website editor.
  • Drag & Drop a Tabs snippet.
  • In the first tab, drag & Drop a Form snippet.
  • Set the first field as a radio buttons.
  • Make the second field's visibility depend on the first field.
  • Add a new tab by clicking the "+" icon in the right panel.
  • Observe that a traceback occurs.

A second issue related to 1 has been resolved for cases where there is
only a single checkbox. In this scenario, the value displayed in the
visibility condition dropdown menu should be "Yes".

opw-4345340

Forward-Port-Of: #191709
Forward-Port-Of: #190460