mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
Merge branch '16.0' of https://github.com/guohuadeng/app-odoo into 16.0
# Conflicts: # app_odoo_customize/__manifest__.py
This commit is contained in:
@@ -77,9 +77,11 @@
|
|||||||
'app_odoo_customize/static/src/js/user_menu.js',
|
'app_odoo_customize/static/src/js/user_menu.js',
|
||||||
'app_odoo_customize/static/src/js/ribbon.js',
|
'app_odoo_customize/static/src/js/ribbon.js',
|
||||||
'app_odoo_customize/static/src/js/dialog.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/*.js',
|
||||||
'app_odoo_customize/static/src/webclient/*.xml',
|
'app_odoo_customize/static/src/webclient/*.xml',
|
||||||
'app_odoo_customize/static/src/xml/res_config_edition.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',
|
'pre_init_hook': 'pre_init_hook',
|
||||||
|
|||||||
@@ -24,3 +24,13 @@ class IrUiMenu(models.Model):
|
|||||||
name = self.name
|
name = self.name
|
||||||
return 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
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<section class="container app">
|
<section class="container app">
|
||||||
<div class="oe_row oe_spaced" style="max-width: 95%;">
|
<div class="oe_row oe_spaced" style="max-width: 95%;">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2 class="oe_slogan">This is a Long Term Support Apps.Update: v16.5.23.09.30</h2>
|
<h2 class="oe_slogan">This is a Long Term Support Apps.Update: v16.24.02.28</h2>
|
||||||
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
|
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<li class="list-group-item">1. Deletes Odoo label in footer</li>
|
<li class="list-group-item">1. Deletes Odoo label in footer</li>
|
||||||
|
|||||||
90
app_odoo_customize/static/src/js/navbar.js
Normal file
90
app_odoo_customize/static/src/js/navbar.js
Normal file
@@ -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: '<div class="tooltip tooltip-field-info" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',
|
||||||
|
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: '<div class="tooltip tooltip-field-info" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',
|
||||||
|
title: qweb.render('Menu.tooltip', debugData),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
NavBar.components.DropdownItem.props.payload = {
|
||||||
|
type: Object,
|
||||||
|
optional: true,
|
||||||
|
};
|
||||||
58
app_odoo_customize/static/src/xml/debug_templates.xml
Normal file
58
app_odoo_customize/static/src/xml/debug_templates.xml
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<templates xml:space="preserve">
|
||||||
|
|
||||||
|
<t t-inherit="web.NavBar" t-inherit-mode="extension" owl="1">
|
||||||
|
<xpath expr="//DropdownItem" position="attributes">
|
||||||
|
<attribute name="payload">currentApp</attribute>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t t-inherit="web.NavBar.AppsMenu" t-inherit-mode="extension" owl="1">
|
||||||
|
<xpath expr="//DropdownItem" position="attributes">
|
||||||
|
<attribute name="payload">app</attribute>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t t-inherit="web.NavBar.SectionsMenu" t-inherit-mode="extension" owl="1">
|
||||||
|
<xpath expr="//DropdownItem" position="attributes">
|
||||||
|
<attribute name="payload">section</attribute>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//MenuDropdown" position="attributes">
|
||||||
|
<attribute name="payload">section</attribute>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t t-inherit="web.NavBar.SectionsMenu.Dropdown.MenuSlot" t-inherit-mode="extension" owl="1">
|
||||||
|
<xpath expr="//DropdownItem" position="attributes">
|
||||||
|
<attribute name="payload">item</attribute>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//div[hasclass('dropdown-menu_group')]" position="attributes">
|
||||||
|
<attribute name="t-att-data-name">item.name</attribute>
|
||||||
|
<attribute name="t-att-data-xmlid">item.xmlid</attribute>
|
||||||
|
<attribute name="t-att-data-sequence">item.sequence</attribute>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t t-inherit="web.NavBar.SectionsMenu.MoreDropdown" t-inherit-mode="extension" owl="1">
|
||||||
|
<xpath expr="//DropdownItem" position="attributes">
|
||||||
|
<attribute name="payload">section</attribute>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t t-name="Menu.tooltip">
|
||||||
|
<div class="oe_tooltip_string" if="title" role="tooltip">
|
||||||
|
<t t-esc="title"/>
|
||||||
|
</div>
|
||||||
|
<ul class="oe_tooltip_technical" role="tooltip">
|
||||||
|
<li t-if="xmlid">
|
||||||
|
<span class="oe_tooltip_technical_title">XMLID:</span>
|
||||||
|
<t t-esc="xmlid"/>
|
||||||
|
</li>
|
||||||
|
<li t-if="typeof sequence === 'number'">
|
||||||
|
<span class="oe_tooltip_technical_title">Sequence:</span>
|
||||||
|
<t t-esc="sequence"/>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
</templates>
|
||||||
Reference in New Issue
Block a user