调整移动端将bar放在下方

This commit is contained in:
ivan deng
2023-05-25 18:49:24 +08:00
parent 199025663a
commit 3b34c2e3f9
9 changed files with 129 additions and 35 deletions

View File

@@ -23,7 +23,7 @@
{ {
'name': 'odoo 16 Customize OEM(Boost, Data reset)', 'name': 'odoo 16 Customize OEM(Boost, Data reset)',
'version': '16.23.05.24', 'version': '16.23.05.25',
'author': 'Sunpop.cn', 'author': 'Sunpop.cn',
'category': 'Productivity', 'category': 'Productivity',
'website': 'https://www.sunpop.cn', 'website': 'https://www.sunpop.cn',
@@ -36,6 +36,7 @@
customize my odoo. customize my odoo.
""", """,
'depends': [ 'depends': [
'app_common',
'base_setup', 'base_setup',
'web', 'web',
'mail', 'mail',
@@ -71,11 +72,11 @@
'app_odoo_customize/static/src/scss/app.scss', 'app_odoo_customize/static/src/scss/app.scss',
'app_odoo_customize/static/src/scss/ribbon.scss', 'app_odoo_customize/static/src/scss/ribbon.scss',
'app_odoo_customize/static/src/scss/dialog.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/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/webclient/**/*.xml', 'app_odoo_customize/static/src/webclient/*.js',
'app_odoo_customize/static/src/webclient/*.xml',
], ],
}, },
'pre_init_hook': 'pre_init_hook', 'pre_init_hook': 'pre_init_hook',
@@ -131,6 +132,7 @@
39. Only erp manager can see debug menu.. 39. Only erp manager can see debug menu..
40. Fix support for enterprise version. 40. Fix support for enterprise version.
41. Fix odoo bug, when click Preferences menu not hide in mobile. 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. This module can help to white label the Odoo.
Also helpful for training and support for your odoo end-user. Also helpful for training and support for your odoo end-user.

View File

@@ -16,8 +16,11 @@
<function model="ir.config_parameter" name="set_param" eval="('app_support_url', 'https://www.sunpop.cn/trial')"/> <function model="ir.config_parameter" name="set_param" eval="('app_support_url', 'https://www.sunpop.cn/trial')"/>
<function model="ir.config_parameter" name="set_param" eval="('app_account_title', 'My Online Account')"/> <function model="ir.config_parameter" name="set_param" eval="('app_account_title', 'My Online Account')"/>
<function model="ir.config_parameter" name="set_param" eval="('app_account_url', 'https://www.sunpop.cn/my-account')"/> <function model="ir.config_parameter" name="set_param" eval="('app_account_url', 'https://www.sunpop.cn/my-account')"/>
<function model="ir.config_parameter" name="set_param" eval="('app_ribbon_name', 'Sunpop.cn')"/> <function model="ir.config_parameter" name="set_param" eval="('app_enterprise_url', 'https://www.odooai.cn')"/>
<function model="ir.config_parameter" name="set_param" eval="('app_ribbon_name', 'odooAi.cn')"/>
<function model="ir.config_parameter" name="set_param" eval="('app_ribbon_color', '#f0f0f0')"/> <function model="ir.config_parameter" name="set_param" eval="('app_ribbon_color', '#f0f0f0')"/>
<function model="ir.config_parameter" name="set_param" eval="('app_ribbon_background_color', 'rgba(255,0,0,.4)')"/> <function model="ir.config_parameter" name="set_param" eval="('app_ribbon_background_color', 'rgba(255,0,0,.4)')"/>
<function model="ir.config_parameter" name="set_param" eval="('app_navbar_pos_pc', 'top')"/>
<function model="ir.config_parameter" name="set_param" eval="('app_navbar_pos_mobile', 'bottom')"/>
</data> </data>
</openerp> </openerp>

View File

@@ -29,4 +29,7 @@ class IrHttp(models.AbstractModel):
# 增加多语言 # 增加多语言
result['app_lang_list'] = self.env['res.lang'].search_read([], ['id', 'code', 'name']) 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') 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 return result

View File

@@ -17,39 +17,43 @@ class ResConfigSettings(models.TransientModel):
help="When enable,User can quick switch language in user menu", help="When enable,User can quick switch language in user menu",
config_parameter='app_show_lang') config_parameter='app_show_lang')
app_show_debug = fields.Boolean('Show Quick Debug', help="When enable,everyone login can see the debug menu", 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", 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', app_show_documentation_dev = fields.Boolean('Show Developer Documentation',
help="When enable,User can visit development 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", app_show_support = fields.Boolean('Show Support', help="When enable,User can vist your support site",
config_parameter='app_show_support') config_parameter='app_show_support')
app_show_account = fields.Boolean('Show My Account', help="When enable,User can login to your website", 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", 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", 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", 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', 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") 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") 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', 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_dev_url = fields.Char('Developer Documentation Url', config_parameter='app_documentation_dev_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', 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')
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')
default='My Online Account') app_enterprise_url = fields.Char('Customize Module Url(eg. Enterprise)', config_parameter='app_enterprise_url')
app_account_url = fields.Char('My Odoo.com Account Url', config_parameter='app_account_url', app_ribbon_name = fields.Char('Show Demo Ribbon', config_parameter='app_ribbon_name')
default='https://www.sunpop.cn/my-account/') app_navbar_pos_pc = fields.Selection(string="Navbar PC", selection=[
app_enterprise_url = fields.Char('Customize Module Url(eg. Enterprise)', config_parameter='app_enterprise_url', ('top', 'Top(Default)'),
default='https://www.sunpop.cn') ('bottom', 'Bottom'),
app_ribbon_name = fields.Char('Show Demo Ribbon', config_parameter='app_ribbon_name', # ('left', 'Left'),
default='*Sunpop.cn') ], 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): def set_module_url(self):
sql = "UPDATE ir_module_module SET website = '%s' WHERE license like '%s' and website <> ''" % (self.app_enterprise_url, 'OEEL%') sql = "UPDATE ir_module_module SET website = '%s' WHERE license like '%s' and website <> ''" % (self.app_enterprise_url, 'OEEL%')

View File

@@ -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
}
});

View File

@@ -17,6 +17,46 @@
content: '/'; 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 // Colors replace to ent
//$o-community-color: #875A7B; //$o-community-color: #875A7B;

View File

@@ -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 });
}
});

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<!-- 移动端nav在下方可配置处理-->
<t t-name="app_web_enterprise.WebClient" t-inherit="web.WebClient" t-inherit-mode="extension">
<xpath expr="//t/t" position="attributes">
<attribute name="t-if">
!state.fullscreen and state.navbar_pos!='bottom'
</attribute>
</xpath>
<xpath expr="//MainComponentsContainer" position="after">
<t t-if="!state.fullscreen and state.navbar_pos=='bottom'">
<NavBar/>
</t>
<!-- <div class="row" style="height:200px">-->
<!-- 增加Debug pad-->
<!-- </div>-->
</xpath>
</t>
</templates>

View File

@@ -21,6 +21,14 @@
</div> </div>
</div> </div>
</group> </group>
<group string="UI Config" name="app_ui_config">
<group>
<field name="app_navbar_pos_pc"/>
</group>
<group>
<field name="app_navbar_pos_mobile"/>
</group>
</group>
<group string="User Menu"> <group string="User Menu">
<group> <group>
<field name="app_show_lang"/> <field name="app_show_lang"/>