From 3b34c2e3f91d3d201e1adf124f1fb2cb3fb202bc Mon Sep 17 00:00:00 2001 From: ivan deng Date: Thu, 25 May 2023 18:49:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=B0=86bar=E6=94=BE=E5=9C=A8=E4=B8=8B=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_odoo_customize/__manifest__.py | 8 ++-- .../data/ir_config_parameter_data.xml | 5 ++- app_odoo_customize/models/ir_http.py | 3 ++ .../models/res_config_settings.py | 40 ++++++++++--------- .../static/src/js/app_window_title.js | 13 ------ app_odoo_customize/static/src/scss/app.scss | 40 +++++++++++++++++++ .../static/src/webclient/webclient.js | 27 +++++++++++++ .../static/src/webclient/webclient.xml | 20 ++++++++++ .../views/app_theme_config_settings_views.xml | 8 ++++ 9 files changed, 129 insertions(+), 35 deletions(-) delete mode 100644 app_odoo_customize/static/src/js/app_window_title.js create mode 100644 app_odoo_customize/static/src/webclient/webclient.js create mode 100644 app_odoo_customize/static/src/webclient/webclient.xml diff --git a/app_odoo_customize/__manifest__.py b/app_odoo_customize/__manifest__.py index c8ef61dd..5ecfe777 100644 --- a/app_odoo_customize/__manifest__.py +++ b/app_odoo_customize/__manifest__.py @@ -23,7 +23,7 @@ { 'name': 'odoo 16 Customize OEM(Boost, Data reset)', - 'version': '16.23.05.24', + 'version': '16.23.05.25', 'author': 'Sunpop.cn', 'category': 'Productivity', 'website': 'https://www.sunpop.cn', @@ -36,6 +36,7 @@ customize my odoo. """, 'depends': [ + 'app_common', 'base_setup', 'web', 'mail', @@ -71,11 +72,11 @@ 'app_odoo_customize/static/src/scss/app.scss', 'app_odoo_customize/static/src/scss/ribbon.scss', 'app_odoo_customize/static/src/scss/dialog.scss', - 'app_odoo_customize/static/src/js/app_window_title.js', '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/webclient/**/*.xml', + 'app_odoo_customize/static/src/webclient/*.js', + 'app_odoo_customize/static/src/webclient/*.xml', ], }, 'pre_init_hook': 'pre_init_hook', @@ -131,6 +132,7 @@ 39. Only erp manager can see debug menu.. 40. Fix support for enterprise version. 41. Fix odoo bug, when click Preferences menu not hide in mobile. + 42. Add menu navbar setup for top or bottom. navigator footer support. This module can help to white label the Odoo. Also helpful for training and support for your odoo end-user. diff --git a/app_odoo_customize/data/ir_config_parameter_data.xml b/app_odoo_customize/data/ir_config_parameter_data.xml index a7ed8f2b..32f65b5b 100644 --- a/app_odoo_customize/data/ir_config_parameter_data.xml +++ b/app_odoo_customize/data/ir_config_parameter_data.xml @@ -16,8 +16,11 @@ - + + + + \ No newline at end of file diff --git a/app_odoo_customize/models/ir_http.py b/app_odoo_customize/models/ir_http.py index 56b47081..fba1cb01 100644 --- a/app_odoo_customize/models/ir_http.py +++ b/app_odoo_customize/models/ir_http.py @@ -29,4 +29,7 @@ class IrHttp(models.AbstractModel): # 增加多语言 result['app_lang_list'] = self.env['res.lang'].search_read([], ['id', 'code', 'name']) result['is_erp_manager'] = self.env.user.has_group('base.group_erp_manager') + # 增加 bar位置处理 + result['app_navbar_pos_pc'] = config_parameter.get_param('app_navbar_pos_pc', 'top') + result['app_navbar_pos_mobile'] = config_parameter.get_param('app_navbar_pos_mobile', 'top') return result diff --git a/app_odoo_customize/models/res_config_settings.py b/app_odoo_customize/models/res_config_settings.py index e930183f..6902ecf6 100644 --- a/app_odoo_customize/models/res_config_settings.py +++ b/app_odoo_customize/models/res_config_settings.py @@ -17,39 +17,43 @@ class ResConfigSettings(models.TransientModel): help="When enable,User can quick switch language in user menu", config_parameter='app_show_lang') app_show_debug = fields.Boolean('Show Quick Debug', help="When enable,everyone login can see the debug menu", - default=True, config_parameter='app_show_debug') + config_parameter='app_show_debug') app_show_documentation = fields.Boolean('Show Documentation', help="When enable,User can visit user manual", - default=False, config_parameter='app_show_documentation') + config_parameter='app_show_documentation') # 停用 app_show_documentation_dev = fields.Boolean('Show Developer Documentation', help="When enable,User can visit development documentation") app_show_support = fields.Boolean('Show Support', help="When enable,User can vist your support site", config_parameter='app_show_support') app_show_account = fields.Boolean('Show My Account', help="When enable,User can login to your website", - default=False, config_parameter='app_show_account') + config_parameter='app_show_account') app_show_enterprise = fields.Boolean('Show Enterprise Tag', help="Uncheck to hide the Enterprise tag", - default=False, config_parameter='app_show_enterprise') + config_parameter='app_show_enterprise') app_show_share = fields.Boolean('Show Share Dashboard', help="Uncheck to hide the Odoo Share Dashboard", - default=False, config_parameter='app_show_share') + config_parameter='app_show_share') app_show_poweredby = fields.Boolean('Show Powered by Odoo', help="Uncheck to hide the Powered by text", - default=False, config_parameter='app_show_poweredby') + onfig_parameter='app_show_poweredby') group_show_author_in_apps = fields.Boolean(string="Show Author in Apps Dashboard", implied_group='app_odoo_customize.group_show_author_in_apps', help="Uncheck to Hide Author and Website in Apps Dashboard") module_odoo_referral = fields.Boolean('Show Odoo Referral', help="Uncheck to remove the Odoo Referral") - app_documentation_url = fields.Char('Documentation Url', config_parameter='app_documentation_url', - default='https://www.sunpop.cn/documentation/user/13.0/en/index.html') + app_documentation_url = fields.Char('Documentation Url', config_parameter='app_documentation_url') app_documentation_dev_url = fields.Char('Developer Documentation Url', config_parameter='app_documentation_dev_url') - app_support_url = fields.Char('Support Url', config_parameter='app_support_url', - default='https://www.sunpop.cn/trial') - app_account_title = fields.Char('My Odoo.com Account Title', config_parameter='app_account_title', - default='My Online Account') - app_account_url = fields.Char('My Odoo.com Account Url', config_parameter='app_account_url', - default='https://www.sunpop.cn/my-account/') - app_enterprise_url = fields.Char('Customize Module Url(eg. Enterprise)', config_parameter='app_enterprise_url', - default='https://www.sunpop.cn') - app_ribbon_name = fields.Char('Show Demo Ribbon', config_parameter='app_ribbon_name', - default='*Sunpop.cn') + app_support_url = fields.Char('Support Url', config_parameter='app_support_url') + app_account_title = fields.Char('My Odoo.com Account Title', config_parameter='app_account_title') + app_account_url = fields.Char('My Odoo.com Account Url', config_parameter='app_account_url') + app_enterprise_url = fields.Char('Customize Module Url(eg. Enterprise)', config_parameter='app_enterprise_url') + app_ribbon_name = fields.Char('Show Demo Ribbon', config_parameter='app_ribbon_name') + app_navbar_pos_pc = fields.Selection(string="Navbar PC", selection=[ + ('top', 'Top(Default)'), + ('bottom', 'Bottom'), + # ('left', 'Left'), + ], config_parameter='app_navbar_pos_pc') + app_navbar_pos_mobile = fields.Selection(string="Navbar Mobile", selection=[ + ('top', 'Top(Default)'), + ('bottom', 'Bottom'), + # ('left', 'Left'), + ], config_parameter='app_navbar_pos_mobile') def set_module_url(self): sql = "UPDATE ir_module_module SET website = '%s' WHERE license like '%s' and website <> ''" % (self.app_enterprise_url, 'OEEL%') diff --git a/app_odoo_customize/static/src/js/app_window_title.js b/app_odoo_customize/static/src/js/app_window_title.js deleted file mode 100644 index 155261eb..00000000 --- a/app_odoo_customize/static/src/js/app_window_title.js +++ /dev/null @@ -1,13 +0,0 @@ -/** @odoo-module **/ - -import { WebClient } from "@web/webclient/webclient"; -import { patch } from "@web/core/utils/patch"; -import { session } from "@web/session"; - -patch(WebClient.prototype, "app_odoo_customize.WebClient", { - setup() { - this._super.apply(this, arguments); - const app_system_name = session.app_system_name || 'odooApp'; - this.title.setParts({ zopenerp: app_system_name }); // zopenerp is easy to grep - } -}); diff --git a/app_odoo_customize/static/src/scss/app.scss b/app_odoo_customize/static/src/scss/app.scss index 70e1d8c0..6086a2d7 100644 --- a/app_odoo_customize/static/src/scss/app.scss +++ b/app_odoo_customize/static/src/scss/app.scss @@ -17,6 +17,46 @@ content: '/'; } } +// navbar在下方的特殊处理 +.o_web_client.navbar_pos_bottom { + .o_navbar { + display: block; + .o_main_navbar { + --o-navbar-height: 40px; + } + } + //message + .o_MessagingMenu_dropdownMenu:not(.o-isDeviceSmall) { + bottom: var(--o-navbar-height) ; + top: auto; + } + .o_MessagingMenu_dropdownMenu.o-isDeviceSmall { + bottom: var(--o-navbar-height)+6!important; ; + height: calc(100% - var(--o-navbar-height)); + top: 0; + } + //Activity + .o_ActivityMenuView_dropdownMenu { + bottom: var(--o-navbar-height) ; + top: auto; + } + //userMenu + .o_burger_menu { + //height: 95%; + } + + // toggle处理 + .dropdown .dropdown-toggle::after { + display: inline-block; + margin-left: 3.4px; + vertical-align: 3.4px; + content: ""; + border-top: 0; + border-right: 4px solid transparent; + border-bottom: 4px solid; + border-left: 4px solid transparent; + } +} // Colors replace to ent //$o-community-color: #875A7B; diff --git a/app_odoo_customize/static/src/webclient/webclient.js b/app_odoo_customize/static/src/webclient/webclient.js new file mode 100644 index 00000000..c2a288e3 --- /dev/null +++ b/app_odoo_customize/static/src/webclient/webclient.js @@ -0,0 +1,27 @@ +/** @odoo-module **/ + +import { WebClient } from "@web/webclient/webclient"; +import { patch } from "@web/core/utils/patch"; +import { session } from "@web/session"; + +patch(WebClient.prototype, "app_odoo_customize.WebClient", { + setup() { + // 处理 navbar 全局可配置位置 + var self = this; + self._super.apply(this, arguments); + this.state.navbar_pos_pc = session.app_navbar_pos_pc || 'top'; + this.state.navbar_pos_mobile = session.app_navbar_pos_mobile || 'top'; + if (self.env.isSmall) + this.state.navbar_pos = this.state.navbar_pos_mobile; + else + this.state.navbar_pos = this.state.navbar_pos_pc; + if (this.state.navbar_pos === 'bottom') { + document.body.className += ' navbar_pos_bottom'; + } + + const app_system_name = session.app_system_name || 'odooAi'; + // zopenerp is easy to grep + this.title.setParts({ zopenerp: app_system_name }); + + } +}); diff --git a/app_odoo_customize/static/src/webclient/webclient.xml b/app_odoo_customize/static/src/webclient/webclient.xml new file mode 100644 index 00000000..1b165a55 --- /dev/null +++ b/app_odoo_customize/static/src/webclient/webclient.xml @@ -0,0 +1,20 @@ + + + + + + + !state.fullscreen and state.navbar_pos!='bottom' + + + + + + + + + + + + + diff --git a/app_odoo_customize/views/app_theme_config_settings_views.xml b/app_odoo_customize/views/app_theme_config_settings_views.xml index 57d29f4c..07ce24f4 100644 --- a/app_odoo_customize/views/app_theme_config_settings_views.xml +++ b/app_odoo_customize/views/app_theme_config_settings_views.xml @@ -21,6 +21,14 @@ + + + + + + + +