update name and css

This commit is contained in:
ivan deng
2017-08-19 12:36:46 +08:00
parent 0ba047d178
commit f31f466f3e
509 changed files with 189 additions and 170 deletions

View File

@@ -0,0 +1,12 @@
odoo.define('app_system_name', function (require) {
"use strict";
var WebClient = require('web.WebClient');
WebClient.include({
init: function() {
this._super.apply(this, arguments);
this.set('title_part', {"zopenerp": document.title});
}
});
});

View File

@@ -0,0 +1,117 @@
odoo.define('app_odoo_customize.customize_user_menu', function (require) {
"use strict";
var Model = require('web.Model');
var session = require('web.session');
var UserMenu = require('web.UserMenu');
var documentation_url;
var documentation_dev_url;
var support_url;
var account_title;
var account_url;
UserMenu.include({
on_menu_debug: function () {
window.location = $.param.querystring(window.location.href, 'debug');
},
on_menu_debugassets: function () {
window.location = $.param.querystring(window.location.href, 'debug=assets');
},
on_menu_quitdebug: function () {
window.location.search = "?";
},
on_menu_documentation: function () {
window.open(documentation_url, '_blank');
},
on_menu_documentation_dev: function () {
window.open(documentation_dev_url, '_blank');
},
on_menu_support: function () {
window.open(support_url, '_blank');
},
on_menu_account: function () {
window.open(account_url, '_blank');
},
});
$(document).ready(function () {
var self = this;
documentation_url = 'http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html';
documentation_dev_url = 'http://www.sunpop.cn/documentation/10.0/index.html';
support_url = 'http://www.sunpop.cn/trial';
account_title = 'My Online Account';
account_url = 'http://www.sunpop.cn/my-account';
setTimeout(function () {
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_show_debug']], ['value']]).then(function (show) {
if (show.length >= 1 && (show[0]['value'] == "False")) {
$('[data-menu="debug"]').parent().hide();
$('[data-menu="debugassets"]').parent().hide();
$('[data-menu="quitdebug"]').parent().hide();
}
});
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_show_documentation']], ['value']]).then(function (show) {
if (show.length >= 1 && (show[0]['value'] == "False"))
$('[data-menu="documentation"]').parent().hide();
else {
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_documentation_url']], ['value']]).then(function (res) {
if (res.length >= 1) {
_.each(res, function (item) {
documentation_url = item['value'];
});
}
});
}
});
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_show_documentation_dev']], ['value']]).then(function (show) {
if (show.length >= 1 && (show[0]['value'] == "False"))
$('[data-menu="documentation_dev"]').parent().hide();
else {
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_documentation_dev_url']], ['value']]).then(function (res) {
if (res.length >= 1) {
_.each(res, function (item) {
documentation_dev_url = item['value'];
});
}
});
}
});
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_show_support']], ['value']]).then(function (show) {
if (show.length >= 1 && (show[0]['value'] == "False"))
$('[data-menu="support"]').parent().hide();
else {
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_support_url']], ['value']]).then(function (res) {
if (res.length >= 1) {
_.each(res, function (item) {
support_url = item['value'];
});
}
});
}
});
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_show_account']], ['value']]).then(function (show) {
if (show.length >= 1 && (show[0]['value'] == "False"))
$('[data-menu="account"]').parent().hide();
else {
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_account_title']], ['value']]).then(function (res) {
if (res.length >= 1) {
_.each(res, function (item) {
account_title = item['value'];
});
}
$('[data-menu="account"]').html(account_title);
});
}
});
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_account_url']], ['value']]).then(function (res) {
if (res.length >= 1) {
_.each(res, function (item) {
account_url = item['value'];
});
}
});
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_show_poweredby']], ['value']]).then(function (show) {
if (show.length >= 1 && (show[0]['value'] == "False"))
$('.o_sub_menu_footer').hide();
});
}, 2000);
});
})

View File

@@ -0,0 +1,49 @@
odoo.define('app_odoo_customize.switch_language', function (require) {
"use strict";
var Model = require('web.Model');
var session = require('web.session');
var UserMenu = require('web.UserMenu');
UserMenu.include({
on_menu_lang: function (ev) {
var self = this;
var lang = ($(ev).data("lang-id"));
new Model('res.users').call('write', [[session.uid], {'lang': lang}]).then(function () {
self.do_action({
type: 'ir.actions.client',
res_model: 'res.users',
tag: 'reload_context',
target: 'current'
});
});
return false;
},
});
//
$(document).ready(function () {
var self = this;
var lang_list = '';
setTimeout(function () {
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_show_lang']], ['value']]).then(function (show) {
if (show.length >= 1 && (show[0]['value'] == "False"))
$('switch-lang').hide();
else {
new Model('res.lang').call('search_read', [[], ['name', 'code']]).then(function (res) {
_.each(res, function (lang) {
var a = '';
if (lang['code'] === session.user_context.lang) {
a = '<i class="fa fa-check"></i>';
} else {
a = '';
}
lang_list += '<li><a href="#" data-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 += '<li class="divider"></li>';
$('switch-lang').replaceWith(lang_list);
});
}
});
}, 2000);
});
});