Odoo 8 - how to change page title?

前端 未结 4 1049
眼角桃花
眼角桃花 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:16

    In Odoo 10, the above solutions does not work. For Odoo 10 we need to edit below JS file

    addons/web/static/src/js/abstract_web_client.js

    Change this code:

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

    With this one:

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

    After this, you restart your Odoo server to see the changes.

    0 讨论(0)
  • 2021-01-06 17:24

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

    <template id="web.layout" name="Web layout">&lt;!DOCTYPE html&gt;
                <html style="height: 100%">
                    <head>
                        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
                        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
                        <title>Odoo</title>
                        <link rel="shortcut icon" href="/web/static/src/img/favicon.ico" type="image/x-icon"/>
                        <link rel="stylesheet" href="/web/static/src/css/full.css" />
                        <t t-raw="head or ''"/>
                    </head>
                    <body t-att-class="body_classname">
                        <t t-raw="0"/>
                    </body>
                </html>
            </template>
    

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

    <?xml version="1.0" encoding="UTF-8"?>
    <openerp>
      <data>
    
        <template id="custom_title" name="change title" inherit_id="web.layout">
          <xpath expr="//title" position="replace">
            <title>Your title</title>
          </xpath>
        </template>
    
      </data>
    </openerp>
    

    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.

    0 讨论(0)
  • 2021-01-06 17:31

    I was digging on version 9 community edition you need to look at the file:

    addons/web/static/src/js/web_client.js

    Change this code:

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

    With this one:

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

    0 讨论(0)
  • 2021-01-06 17:31

    1- In addons/web/static/src/js/chrome.js: Search all words containing "Odoo" and replace

    2- after : Search en local modules --> a module named "Web" --> upgrade

    0 讨论(0)
提交回复
热议问题