diff --git a/extensions/odoo_theme/__init__.py b/extensions/odoo_theme/__init__.py
index 6b167c589..83346e06b 100644
--- a/extensions/odoo_theme/__init__.py
+++ b/extensions/odoo_theme/__init__.py
@@ -39,9 +39,7 @@ class Monkey(object):
def resolve(old_resolve, tree, docname, *args, **kwargs):
resolved_toc = old_resolve(tree, docname, *args, **kwargs)
if resolved_toc:
- # Not sure set_class really does what we want.
_toctree_add_empty_class(tree, resolved_toc, docname)
- resolved_toc['classes'].append('testtesttest')
return resolved_toc
def _toctree_add_empty_class(tree, node, docname) -> None:
@@ -57,6 +55,7 @@ def _toctree_add_empty_class(tree, node, docname) -> None:
toc_ref = get_reference(subnode, docname)
if toc_ref and 'empty_page' in tree.env.metadata[toc_ref]:
subnode['classes'].append('o_empty_page')
+ subnode['refuri'] = '#' # The link must not be clickable
def get_reference(node, docname):
ref = node['refuri'].replace('.html', '') # applications.html
diff --git a/extensions/odoo_theme/static/js/menu.js b/extensions/odoo_theme/static/js/menu.js
index 0a0a5cf11..5eab43a91 100644
--- a/extensions/odoo_theme/static/js/menu.js
+++ b/extensions/odoo_theme/static/js/menu.js
@@ -17,19 +17,29 @@
/**
* Add the relevant classes on the TOC entries (and lists) whose page is displayed.
*
- * TOC entries whose page is displayed (
elements) receive the `o_active_toc_entry` class
- * and their related TOC entry list ( elements) receive the `show` (Bootstrap) class.
+ * TOC entries (- elements) that are on the path of the displayed page receive the
+ * `o_active_toc_entry` class, and their related (parent) TOC entry list (
elements) receive
+ * the `show` (Bootstrap) class. The child TOC entry list of the deepest TOC entry also
+ * receives the `show` class.
*/
const _flagActiveTocEntriesAndLists = () => {
+ let deepestTocEntry = undefined;
this.navigationMenu.querySelectorAll('.current').forEach(element => {
- if (element.tagName === 'LI') {
- // Highlight all - in the active hierarchy
- element.classList.add('o_active_toc_entry');
- } else if (element.tagName === 'UL') {
+ if (element.tagName === 'UL') {
// Expand all related
element.classList.add('show');
+ } else if (element.tagName === 'LI') {
+ // Highlight all - in the active hierarchy
+ element.classList.add('o_active_toc_entry');
+ deepestTocEntry = element;
}
})
+ if (deepestTocEntry) {
+ const childTocEntryList = deepestTocEntry.querySelector('ul');
+ if (childTocEntryList) {
+ childTocEntryList.classList.add('show');
+ }
+ }
};
/**
diff --git a/extensions/odoo_theme/static/js/utils.js b/extensions/odoo_theme/static/js/utils.js
index 4892eb761..38c4365e6 100644
--- a/extensions/odoo_theme/static/js/utils.js
+++ b/extensions/odoo_theme/static/js/utils.js
@@ -18,13 +18,21 @@ let tocEntryListId = 0; // Used to generate IDs of toc entry lists for both the
* elements followed by a
, we simply loop on elements to access all parts of the DOM
* that need to be modified.
*
- * For a given and