mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
v1 update odoo_customize
This commit is contained in:
@@ -62,7 +62,7 @@ The user can get the help document just by one click.
|
||||
'depends': ['base', 'web', 'mail'],
|
||||
'data': [
|
||||
'views/app_odoo_customize_view.xml',
|
||||
'views/app_theme_config_settings_view.xml',
|
||||
# 'views/app_theme_config_settings_view.xml',
|
||||
'views/ir_model_view.xml',
|
||||
# data
|
||||
'data/ir_config_parameter.xml',
|
||||
|
||||
@@ -12,10 +12,10 @@ odoo.define('app_odoo_customize.UserMenu', function (require) {
|
||||
var UserMenu = require('web.UserMenu');
|
||||
//避免错误,要再定义
|
||||
var documentation_url = 'http://www.sunpop.cn';
|
||||
var documentation_dev_url;
|
||||
var support_url;
|
||||
var account_title;
|
||||
var account_url;
|
||||
var documentation_dev_url = 'http://www.sunpop.cn';
|
||||
var support_url = 'http://www.sunpop.cn';
|
||||
var account_title = 'My Account';
|
||||
var account_url = 'http://www.sunpop.cn';
|
||||
|
||||
UserMenu.include({
|
||||
init: function () {
|
||||
@@ -38,60 +38,61 @@ odoo.define('app_odoo_customize.UserMenu', function (require) {
|
||||
} else {
|
||||
a = '';
|
||||
}
|
||||
lang_list += '<li><a href="#" data-lang-menu="lang" data-lang-id="' + lang['code'] + '"><img class="flag" src="app_odoo_customize/static/src/img/flags/' + lang['code'] + '.png"/>' + lang['name'] + a + '</a></li>';
|
||||
lang_list += '<a role="menuitem" href="#" class="dropdown-item" data-lang-menu="lang" data-lang-id="' + lang['code']
|
||||
+ '"><img class="flag" src="app_odoo_customize/static/src/img/flags/' + lang['code'] + '.png"/>' + lang['name'] + a + '</a>';
|
||||
});
|
||||
lang_list += '<li class="divider"></li>';
|
||||
lang_list += '<div role="separator" class="dropdown-divider"/>';
|
||||
$('switch-lang').replaceWith(lang_list);
|
||||
})
|
||||
|
||||
//取参数
|
||||
self._rpc({
|
||||
model: 'ir.config_parameter',
|
||||
method: 'search_read',
|
||||
domain: [['key', '=like', 'app_%']],
|
||||
fields: ['key', 'value'],
|
||||
lazy: false,
|
||||
}).then(function (res) {
|
||||
$.each(res, function (key, val) {
|
||||
if (val.key == 'app_documentation_url')
|
||||
documentation_url = val.value;
|
||||
if (val.key == 'app_documentation_dev_url')
|
||||
documentation_dev_url = val.value;
|
||||
if (val.key == 'app_support_url')
|
||||
support_url = val.value;
|
||||
if (val.key == 'app_account_title')
|
||||
account_title = val.value;
|
||||
if (val.key == 'app_account_url')
|
||||
account_url = val.value;
|
||||
// 控制显示
|
||||
if (val.key == 'app_show_lang' && val.value == "False") {
|
||||
$('switch-lang').hide();
|
||||
}
|
||||
if (session.user_context.uid!=1 || (val.key == 'app_show_debug' && val.value == "False")) {
|
||||
$('[data-menu="debug"]').parent().hide();
|
||||
$('[data-menu="debugassets"]').parent().hide();
|
||||
$('[data-menu="quitdebug"]').parent().hide();
|
||||
}
|
||||
if (val.key == 'app_show_documentation' && val.value == "False") {
|
||||
$('[data-menu="documentation"]').parent().hide();
|
||||
}
|
||||
if (val.key == 'app_show_documentation_dev' && val.value == "False") {
|
||||
$('[data-menu="documentation_dev"]').parent().hide();
|
||||
}
|
||||
if (val.key == 'app_show_support' && val.value == "False") {
|
||||
$('[data-menu="support"]').parent().hide();
|
||||
}
|
||||
if (val.key == 'app_show_account' && val.value == "False") {
|
||||
$('[data-menu="account"]').parent().hide();
|
||||
}
|
||||
if (val.key == 'app_account_title' && val.value) {
|
||||
$('[data-menu="account"]').html(account_title);
|
||||
}
|
||||
if (val.key == 'app_show_poweredby' && val.value == "False") {
|
||||
$('.o_sub_menu_footer').hide();
|
||||
}
|
||||
});
|
||||
})
|
||||
// self._rpc({
|
||||
// model: 'ir.config_parameter',
|
||||
// method: 'search_read',
|
||||
// domain: [['key', '=like', 'app_%']],
|
||||
// fields: ['key', 'value'],
|
||||
// lazy: false,
|
||||
// }).then(function (res) {
|
||||
// $.each(res, function (key, val) {
|
||||
// if (val.key == 'app_documentation_url')
|
||||
// documentation_url = val.value;
|
||||
// if (val.key == 'app_documentation_dev_url')
|
||||
// documentation_dev_url = val.value;
|
||||
// if (val.key == 'app_support_url')
|
||||
// support_url = val.value;
|
||||
// if (val.key == 'app_account_title')
|
||||
// account_title = val.value;
|
||||
// if (val.key == 'app_account_url')
|
||||
// account_url = val.value;
|
||||
// // 控制显示
|
||||
// if (val.key == 'app_show_lang' && val.value == "False") {
|
||||
// $('switch-lang').hide();
|
||||
// }
|
||||
// if (session.user_context.uid!=1 || (val.key == 'app_show_debug' && val.value == "False")) {
|
||||
// $('[data-menu="debug"]').parent().hide();
|
||||
// $('[data-menu="debugassets"]').parent().hide();
|
||||
// $('[data-menu="quitdebug"]').parent().hide();
|
||||
// }
|
||||
// if (val.key == 'app_show_documentation' && val.value == "False") {
|
||||
// $('[data-menu="documentation"]').parent().hide();
|
||||
// }
|
||||
// if (val.key == 'app_show_documentation_dev' && val.value == "False") {
|
||||
// $('[data-menu="documentation_dev"]').parent().hide();
|
||||
// }
|
||||
// if (val.key == 'app_show_support' && val.value == "False") {
|
||||
// $('[data-menu="support"]').parent().hide();
|
||||
// }
|
||||
// if (val.key == 'app_show_account' && val.value == "False") {
|
||||
// $('[data-menu="account"]').parent().hide();
|
||||
// }
|
||||
// if (val.key == 'app_account_title' && val.value) {
|
||||
// $('[data-menu="account"]').html(account_title);
|
||||
// }
|
||||
// if (val.key == 'app_show_poweredby' && val.value == "False") {
|
||||
// $('.o_sub_menu_footer').hide();
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
@@ -101,7 +102,7 @@ odoo.define('app_odoo_customize.UserMenu', function (require) {
|
||||
var self = this;
|
||||
return this._super.apply(this, arguments).then(function () {
|
||||
//语言切换特殊处理
|
||||
self.$el.on('click', 'li a[data-lang-menu]', function (ev) {
|
||||
self.$el.on('click', 'a[data-lang-menu]', function (ev) {
|
||||
ev.preventDefault();
|
||||
var f = self['_onMenuLang']
|
||||
f.call(self, $(this));
|
||||
@@ -113,11 +114,11 @@ odoo.define('app_odoo_customize.UserMenu', function (require) {
|
||||
if (window.location.href.indexOf('debug=assets') != -1)
|
||||
mMode = 'assets';
|
||||
if (mMode == 'normal')
|
||||
$('[data-menu="quitdebug"]').parent().hide();
|
||||
$('[data-menu="quitdebug"]').hide();
|
||||
if (mMode == 'debug')
|
||||
$('[data-menu="debug"]').parent().hide();
|
||||
$('[data-menu="debug"]').hide();
|
||||
if (mMode == 'assets')
|
||||
$('[data-menu="debugassets"]').parent().hide();
|
||||
$('[data-menu="debugassets"]').hide();
|
||||
});
|
||||
},
|
||||
_onMenuAccount: function () {
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
<t t-extend="UserMenu">
|
||||
<t t-jquery=".dropdown-menu" t-operation="prepend">
|
||||
<t t-extend="UserMenu.Actions">
|
||||
<t t-jquery="a[data-menu='documentation']" t-operation="before">
|
||||
<switch-lang/>
|
||||
<li>
|
||||
<a href="#" data-menu="debug">Activate the developer mode</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-menu="debugassets">Activate the developer mode (with assets)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-menu="quitdebug">Deactivate the developer mode</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-menu="documentation_dev">Developer Manual</a>
|
||||
</li>
|
||||
<li class="divider"/>
|
||||
<a role="menuitem" href="#" data-menu="debug" class="dropdown-item">Activate the developer mode</a>
|
||||
<a role="menuitem" href="#" data-menu="debugassets" class="dropdown-item">Activate the developer mode (with assets)</a>
|
||||
<a role="menuitem" href="#" data-menu="quitdebug" class="dropdown-item">Deactivate the developer mode</a>
|
||||
<div role="separator" class="dropdown-divider"/>
|
||||
<a role="menuitem" href="#" data-menu="documentation_dev" class="dropdown-item">Developer Manual</a>
|
||||
</t>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
Reference in New Issue
Block a user