Odoo 8 - how to change page title?

前端 未结 4 1048
眼角桃花
眼角桃花 2021-01-06 16:37

i was wondering how to change page titles and remove Odoo from it?

https://www.odoo.com/forum/help-1/question/change-login-page-title-34874 I tried this but i found

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-06 17:24

    The title is set using the standard html tag in /addons/web/views/webclient_templates.xml, in the web.layout template:

    
    

    So you can change it in a xml file in a custom module, like this:

    
    
      
    
        
    
      
    
    

    Be sure to declare the xml file in the manifest file and reload the module.

    This works for the login page (if the selected database has the module with this change installed) but it won't work in most of the other pages, because when a view is loaded the title is changed dynamically by the javascript client. (to reflect the view you are in, e.g. "Products - Odoo" or "Customers - Odoo")

    To change that, you have to extend the JS web client and edit it like this:

    openerp.your_module_name = function(instance) {
        instance.web.WebClient.include({
            init: function(parent, client_options) {
                this._super(parent, client_options);
                this.set('title_part', {"zopenerp": "Your Title"});
            },
        });
    };
    

    Be sure you do all the necessary for odoo to include your js file, see some examples of simple webclient modules, e.g. web_dialog_size

    With these 2 modifications, you should see your custom page title in all the Odoo pages.

提交回复
热议问题