跳至内容
菜单
此问题已终结
5 回复
41218 查看

How to change the title of the page from to any custom title


I have already extended the web.layout , web.login_layout. I want to change the dynamic page title of odoo in a custom module. Please tell me if there is any other way other than changing web_client.js file's zopenerp property.  I also tried to override the init function in web_client.js but it is not working


openerp.edit_title_module = function(instance) {
    // THIS CONSOLE LOG IS PRINTING
    consloe.log("Print 1")
    instance.web.webclient.extend({
        init: function(parent, client_options) {
            // BUT THIS CONSOLE LOG IS NOT EXECUTING
            consloe.log("Print 2")
            this._super(parent, client_options);
            this.set('title_part', {"zopenerp": "My custom title"});
        },
    });
};

形象
丢弃

What title do you mean? Can you provide a screenshot?

编写者

I mean the page's title appearing in browser's tab, I am not able to edit the question,When ever I try to edit and save, It shows 403 forbidden that's why I am not able to post a screen shot

You can add a link to a screenshot here as a comment.

最佳答案

In Odoo 10, you have to change 

this.set('title_part', {"zopenerp": "Your Company Name"});

in web/static/src/js/abstract_web_client.js file.

形象
丢弃
最佳答案

Thank alls,


I used code below for Odoo V13 and it's worked.

odoo.define('your_module_name.WebClient', function (require) {

"use strict";

    var AbstractWebClient = require('web.AbstractWebClient');

    AbstractWebClient = AbstractWebClient.include({

        start: function (parent) {

            this.set('title_part', {"zopenerp": "Your title!"});

            this._super(parent);

        },

    });

});


形象
丢弃

Hi, this worked perfectly for me!

Regards.

Hi all, I'm using Odoo v15, I tried this but it doesn't seem to work with me. Is there any solution? Thank alls

编写者 最佳答案

I got the answer for the My question 

https://stackoverflow.com/questions/40418642/odoo-9-inherit-js-file


Visit this stack overflow link, This is working in Odoo 9 


openerp.module_name = function(instance){
    var _t = instance.web._t,
    _lt = instance.web._lt;
    var QWeb = instance.web.qweb;

    instance.web.WebClient.include({

        start: function() {
            this.set('title_part', {"zopenerp": "Odoo9"});
            return this._super();
            },
        });
}
形象
丢弃
最佳答案

hai,

after changing 

this.set('title_part', {"zopenerp": "Odoo9"}); to 

this.set('title_part', {"zopenerp": "Your required name"}); try to open the localhost in another browser. This was because of cache that wont allow the changes in present browser
形象
丢弃
最佳答案

There is a free module that lets you change the title. Plus it conveniently adds a field in the settings menu so you can change the title anytime instead of hard-coding it. It's available for a whole bunch of Odoo versions.

https://apps.odoo.com/apps/modules/13.0/web_window_title/

And even if you don't want to install it it's very helpful to look up/compare your code.

形象
丢弃
相关帖文 回复 查看 活动
1
12月 24
6152
3
8月 24
7023
4
7月 24
41390
5
4月 23
99277
3
11月 22
4437