Odoo 8-如何更改页面标题? [英] Odoo 8 - how to change page title?

查看:170
本文介绍了Odoo 8-如何更改页面标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何更改页面标题并从中删除Odoo?

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 我试过了,但一无所获.

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

推荐答案

标题是使用/addons/web/views/webclient_templates.xml,在web.layout模板中:

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>

因此,您可以在自定义模块的xml文件中更改它,如下所示:

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>

确保在清单文件中声明xml文件并重新加载模块.

这适用于登录页面(如果选定的数据库安装了具有此更改的模块),但不适用于其他大多数页面,因为当加载视图时,JavaScript客户端会动态更改标题. (以反映您所处的视图,例如产品-Odoo" 或客户-Odoo")

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

要更改此设置,您必须扩展JS Web客户端并像这样进行

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

请确保您已完成odoo包含js文件的所有必要操作,请参见一些简单的Webclient模块示例,例如 web_dialog_size

进行这两项修改后,您应该在所有Odoo页面中看到您的自定义页面标题.

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

这篇关于Odoo 8-如何更改页面标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆