Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5 Trả lời
41199 Lượt xem

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"});
        },
    });
};

Ảnh đại diện
Huỷ bỏ

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

Tác giả

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.

Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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);

        },

    });

});


Ảnh đại diện
Huỷ bỏ

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

Tác giả Câu trả lời hay nhất

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();
            },
        });
}
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 24
6142
3
thg 8 24
7015
4
thg 7 24
41380
5
thg 4 23
99251
3
thg 11 22
4428