Ir al contenido
Menú
Se marcó esta pregunta
5 Respuestas
41189 Vistas

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

Avatar
Descartar

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

Autor

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.

Mejor respuesta

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.

Avatar
Descartar
Mejor respuesta

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

        },

    });

});


Avatar
Descartar

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

Autor Mejor respuesta

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();
            },
        });
}
Avatar
Descartar
Mejor respuesta

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
Avatar
Descartar
Mejor respuesta

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.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
dic 24
6139
3
ago 24
7008
4
jul 24
41376
5
abr 23
99240
3
nov 22
4423