diff options
| author | Achraf (abz) <abz@odoo.com> | 2021-05-07 08:07:46 +0000 |
|---|---|---|
| committer | Achraf (abz) <abz@odoo.com> | 2021-05-11 08:01:26 +0000 |
| commit | 96564dd64bdbd426ae87444fd75a822074a37fc0 (patch) | |
| tree | 591101b387a9667d5e22a42cb98e3c8d1bb1a04f /addons/web/static/src/js/views/form | |
| parent | f882512fea32784944ecccdd921c96576869b2e6 (diff) | |
[FIX] web: Allow user to add product Description with studio
What are the steps to reproduce your issue ?
1. From the product form, go to the website version, edit it to add tabs
2. Using studio, add the field "Description for website" to a tab of the notebook
3. Save, click Edit, go to the tab that has the field
What is currently happening ?
Traceback:
form_renderer.js:258 Uncaught (in promise) TypeError: Cannot read property 'querySelector' of undefined
at Class.setLocalState (form_renderer.js:258)
at Class.setLocalState (form_editor.js:131)
at Class.prototype.<computed> [as setLocalState] (class.js:90)
at view_editor_manager.js:184
What are you expecting to happen ?
Correctly add product description without tracebacks
Why is this happening ?
Because the number of tab is not equal to the number of pages
How to fix the bug ?
Before accessing the element, check if it exists
opw-2378743
closes odoo/odoo#70513
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/form')
| -rw-r--r-- | addons/web/static/src/js/views/form/form_renderer.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js index 9a2f2620fb6..7aa363b9ea2 100644 --- a/addons/web/static/src/js/views/form/form_renderer.js +++ b/addons/web/static/src/js/views/form/form_renderer.js @@ -238,7 +238,7 @@ var FormRenderer = BasicRenderer.extend({ const name = notebook.dataset.name; if (name in state) { const navs = notebook.querySelectorAll(':scope .o_notebook_headers .nav-item'); - const pages = notebook.querySelectorAll(':scope .tab-content > .tab-pane'); + const pages = notebook.querySelectorAll(':scope > .tab-content > .tab-pane'); // We can't base the amount on the 'navs' length since some overrides // are adding pageless nav items. const validTabsAmount = pages.length; |
