修改源码方式
修改源文件/addon/web/static/src/js/chrome/abstract_web_client.js
第96行
//this.set('title_part', {"zopenerp": "Odoo"});
this.set('title_part', {"zopenerp": "My Title"});
效果如图
image.png
不侵入odoo源码的处理
添加debrand.js文件到static/src/js目录下
odoo.define('yumtown.debrand', function(require){
"use strict";
var WebClient = require('web.WebClient');
var TranslationDataBase = require('web.translation'.TranslationDataBase);
var title = document.title;
WebClient.include({
init: function(parent){
this._super(parent);
this.set('title_part',{'zopenerp': title});
},
});
TranslationDataBase.included({
get: function(key){
var res= this._super(key);
var res= res == null ? key : res;
if(res!=null){
res.replace('odoo', title);
res.replace('Odoo', title);
}
return res;
}
})
});
<template id="assets_backend" name="client_warning" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/modulename/static/src/js/debrand.js"/>
</xpath>
</template>
<template id="my_weisite_layout" inherit_id="web.layout" name="my web Layout">
<xpath expr="//title" position="replace">
<title t-esc="title or 'mytitle'"/>
</xpath>
<xpath expr="//link[@rel='shortcut icon']" position="replace">
<link rel="shortcut icon" href="/modulename/static/src/img/favicon.png" type="image/x-icon"/>
</xpath>
</template>
推荐第二种做法
网友评论