修改标题栏中的odoo字样

修改源码方式

修改源文件/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>

推荐第二种做法

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,398评论 19 139
  • 雨不停下 滴滴又嗒嗒 敲在窗上 落在地下 我抬头望 满目悲伤 远方的人儿啊 想把相思寄往 点点滴滴 化在我手心 住...
    弓长木水阅读 1,800评论 4 2
  • 效能评价准则在于产出匹配产能,而不是以单一的产出或产能的高低来衡量。任何的单一评价或偏重,都是低效能,产出...
    jiazy2017阅读 3,345评论 0 0
  • 六月是离别的笙箫,吹响低沉的凄凉,忙碌与离别,是六月的主调! 多雨的季节,奏响惆怅,滴落的雨滴,打在脸上,无人愿意...
    柒殇祭阅读 2,600评论 0 0