From 1a2072d91ea0e40cbc2693a69a9a6712c1ab945b Mon Sep 17 00:00:00 2001 From: Chill Date: Wed, 28 Feb 2024 16:34:00 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#I947I0=2016=E7=89=88=E6=9C=AC=E7=9A=84ap?= =?UTF-8?q?p=5Fodoo=5Fcustomize=E5=A2=9E=E5=8A=A0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E5=AF=B9=E8=8F=9C=E5=8D=95=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=98=BE=E7=A4=BAdebug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_odoo_customize/__manifest__.py | 4 +- app_odoo_customize/models/ir_ui_menu.py | 10 +++ .../static/description/index.html | 2 +- app_odoo_customize/static/src/js/navbar.js | 90 +++++++++++++++++++ .../static/src/xml/debug_templates.xml | 58 ++++++++++++ 5 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 app_odoo_customize/static/src/js/navbar.js create mode 100644 app_odoo_customize/static/src/xml/debug_templates.xml diff --git a/app_odoo_customize/__manifest__.py b/app_odoo_customize/__manifest__.py index 2c88e80d..a28e1c73 100644 --- a/app_odoo_customize/__manifest__.py +++ b/app_odoo_customize/__manifest__.py @@ -23,7 +23,7 @@ { 'name': 'odoo17 Tweak,Ai Employee,Boost,Customize All in One. Customize,UI,Boost,Security,Data', - 'version': '16.24.01.15', + 'version': '16.24.02.28', 'author': 'odooai.cn', 'category': 'Extra Tools', 'website': 'https://www.odooai.cn', @@ -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 + + + + + + + + +