diff --git a/app_odoo_customize/__manifest__.py b/app_odoo_customize/__manifest__.py index f3044a23..10f48abf 100644 --- a/app_odoo_customize/__manifest__.py +++ b/app_odoo_customize/__manifest__.py @@ -77,9 +77,11 @@ 'app_odoo_customize/static/src/js/user_menu.js', 'app_odoo_customize/static/src/js/ribbon.js', 'app_odoo_customize/static/src/js/dialog.js', + 'app_odoo_customize/static/src/js/navbar.js', 'app_odoo_customize/static/src/webclient/*.js', 'app_odoo_customize/static/src/webclient/*.xml', 'app_odoo_customize/static/src/xml/res_config_edition.xml', + 'app_odoo_customize/static/src/xml/debug_templates.xml', ], }, 'pre_init_hook': 'pre_init_hook', diff --git a/app_odoo_customize/models/ir_ui_menu.py b/app_odoo_customize/models/ir_ui_menu.py index 98a32443..3233fd54 100644 --- a/app_odoo_customize/models/ir_ui_menu.py +++ b/app_odoo_customize/models/ir_ui_menu.py @@ -24,3 +24,13 @@ class IrUiMenu(models.Model): name = self.name return name + def load_web_menus(self, debug): + web_menus = super(IrUiMenu, self).load_web_menus(debug) + if debug: + menus = self.load_menus(debug) # This method has been cached in ORM and does not affect the performance + for menu_id in web_menus.keys(): + if menu_id == 'root': + web_menus[menu_id]['sequence'] = 0 + continue + web_menus[menu_id]['sequence'] = menus[menu_id]['sequence'] + return web_menus \ No newline at end of file diff --git a/app_odoo_customize/static/description/index.html b/app_odoo_customize/static/description/index.html index d0cb9346..0176ddf4 100644 --- a/app_odoo_customize/static/description/index.html +++ b/app_odoo_customize/static/description/index.html @@ -20,7 +20,7 @@
-

This is a Long Term Support Apps.Update: v16.5.23.09.30

+

This is a Long Term Support Apps.Update: v16.24.02.28

  • 1. Deletes Odoo label in footer
  • diff --git a/app_odoo_customize/static/src/js/navbar.js b/app_odoo_customize/static/src/js/navbar.js new file mode 100644 index 00000000..c75e520d --- /dev/null +++ b/app_odoo_customize/static/src/js/navbar.js @@ -0,0 +1,90 @@ +/** @odoo-module **/ + +import {NavBar} from '@web/webclient/navbar/navbar'; +import {useEffect, useRef} from '@odoo/owl'; +import {patch} from 'web.utils'; +import config from 'web.config'; +import {qweb} from 'web.core'; + +patch(NavBar.components.MenuDropdown.prototype, 'app_odoo_customize/static/src/js/menu_dropdown.js', { + setup() { + this._super(); + useEffect(() => this.addDebugTooltip()); + }, + addDebugTooltip() { + if (config.isDebug()) { + let dropdownDebugData = this.getDebugData() + $(this.rootRef.el).find('.dropdown-toggle') + .removeAttr('title') + .tooltip(this.getDebugTooltip(dropdownDebugData)); + var self = this; + _.each($(this.rootRef.el).find('.dropdown-menu_group'), function (menuGroup, index) { + let $menuGroup = $(menuGroup); + let menuGroupDebugData = self.getMenuGroupDebugData($menuGroup); + $menuGroup.tooltip(self.getDebugTooltip(menuGroupDebugData)); + }) + } + }, + getDebugData() { + return { + title: this.props.payload.name, + xmlid: this.props.payload.xmlid, + sequence: this.props.payload.sequence, + } + }, + getMenuGroupDebugData($menuGroup) { + return { + title: $menuGroup.data('name'), + xmlid: $menuGroup.data('xmlid'), + sequence: $menuGroup.data('sequence'), + } + }, + getDebugTooltip(debugData) { + return { + template: '', + title: qweb.render('Menu.tooltip', debugData), + }; + } +}) +NavBar.components.MenuDropdown.props.payload = { + type: Object, + optional: true, +}; +patch(NavBar.components.DropdownItem.prototype, 'app_odoo_customize/static/src/js/menu_item.js', { + setup() { + this._super(); + useEffect(() => this.addDebugTooltip()); + }, + addDebugTooltip() { + if (config.isDebug()) { + let menuDebugData = this.getDebugData(); + if (!menuDebugData) { + return; + } + $(`.dropdown-item[data-menu-xmlid="${menuDebugData.xmlid}"], .dropdown-item[data-section="${menuDebugData.id}"]`) + .removeAttr('title') + .tooltip(this.getDebugTooltip(menuDebugData)); + } + }, + getDebugData() { + if (!this.props.payload) { + return null; + } + return { + id: this.props.payload.id, + title: this.props.payload.name, + xmlid: this.props.payload.xmlid, + sequence: this.props.payload.sequence, + } + }, + getDebugTooltip(debugData) { + return { + template: '', + title: qweb.render('Menu.tooltip', debugData), + }; + } +}) +NavBar.components.DropdownItem.props.payload = { + type: Object, + optional: true, +}; diff --git a/app_odoo_customize/static/src/xml/debug_templates.xml b/app_odoo_customize/static/src/xml/debug_templates.xml new file mode 100644 index 00000000..991a31e5 --- /dev/null +++ b/app_odoo_customize/static/src/xml/debug_templates.xml @@ -0,0 +1,58 @@ + + + + + + currentApp + + + + + + app + + + + + + section + + + section + + + + + + item + + + item.name + item.xmlid + item.sequence + + + + + + section + + + + + + + + +