如何更改浏览器标题?

时间:2014-08-13 19:47:16

标签: javascript python-2.7 openerp-7

默认情况下,浏览器标题为

OpenERP

或者,一旦进入系统,就像

Partners - OpenERP

如何更改以包含公司的品牌?

Partners - My Cool Company

1 个答案:

答案 0 :(得分:2)

为您的安装创建主模块 - my_cool_company,例如:

__init__.py

from openerp.addons.web.controllers import main

main.html_template = main.html_template.replace(
    '<title>OpenERP</title>',
    '<title>My Cool Company</title>'
    )

__openerp__.py

.
.
.
'depends': [
    'web',
    ],
'js': [
    'static/src/js/branding.js',
    ],
.
.
.

static/src/js/branding.js

openerp.my_cool_company = function(instance) {
    instance.web.WebClient.include({
        set_title: function(title) {
            title = _.str.clean(title);
            var sep = _.isEmpty(title) ? '' : ' - ';
            document.title = title + sep + 'My Cool Company';
        },
    });
};