-
- Downloads
[IMP] web: form: labels of several occurrences of a field
Before this commit, when the same field occurred multiple times in a form view, all occurrences were associated with the same id, and all occurrences of the corresponding label (if any) had the same 'for' attribute. As a consequence, besides the fact that there were warnings in the chrome console, clicking on any occurrence of the duplicated label focuses the first occurrence of the field. This commit generates a unique id for each pair label/field, when possible. However, there is a case that can't be handled automatically: when the label isn't automatically generated (field located outside a group, or with nolabel attribute set to "1"). Typically, in this case, there is a <label> node with "for" attribute referencing the associated field. In this situation, the id must be defined in the arch, and used in the "for" attribute: <form> <label for="phone"/><field name="phone"/> <label for="phone_2"/><field name="phone" id="phone_2"/> </form> Task 2261697
Showing
- addons/web/static/src/js/views/form/form_renderer.js 33 additions, 29 deletionsaddons/web/static/src/js/views/form/form_renderer.js
- addons/web/static/src/js/views/form/form_view.js 35 additions, 1 deletionaddons/web/static/src/js/views/form/form_view.js
- addons/web/static/tests/views/form_tests.js 210 additions, 0 deletionsaddons/web/static/tests/views/form_tests.js
- doc/reference/views.rst 24 additions, 0 deletionsdoc/reference/views.rst
- odoo/addons/base/models/ir_ui_view.py 11 additions, 9 deletionsodoo/addons/base/models/ir_ui_view.py
- odoo/addons/base/tests/test_views.py 1 addition, 1 deletionodoo/addons/base/tests/test_views.py
Loading
Please register or sign in to comment