我需要一些帮助,你知道如何更改背景图片的odoov8登录吗?我已经开发了一个主题自定义模块,我试图替换图像;这是代码:
<template id="login_layout" name="My Theme Login" inherit_id="web.login_layout">
<xpath expr="//div[@class='oe_single_form_footer']" position="replace">
<div class="oe_single_form_footer">Powered by T</div><!-- it works-->
</xpath>
<xpath expr="//div[@class='oe_single_form']" position="replace">
<div class="oe_single_form"><img src="/static/src/img/logo.png'" alt="My Theme Logo" title="My Theme Logo" /></div>
</xpath>
</template>
但我得到的错误是:
Element '<xpath expr="//div[@class='oe_single_form']">' cannot be located in parent view
和它的继承模板中的逻辑原因不同于“oe_single_form_footer”,“oe_single_form”它不在div balise中(抱歉我是odoo的新手):
<template id="web.login_layout" name="Login Layout">
<t t-call="web.layout">
<t t-set="head">
<link href="/web/static/src/css/base.css" rel="stylesheet"/>
<link href="/web/static/lib/bootstrap/css/bootstrap.css" rel="stylesheet"/>
</t>
<t t-set="body_classname" t-value="'oe_single_form'"/>
<div class="oe_single_form_container modal-content">
<div class="oe_single_form_logo">
<img t-attf-src="/web/binary/company_logo{{ '?dbname='+db if db else '' }}"/>
</div>
<hr/>
<t t-raw="0"/>
<div class="oe_single_form_footer" t-if="not disable_footer">
<t t-if="not disable_database_manager">
<a class="oe_login_manage_db" t-attf-href="/web/database/manager{{ '?debug' if debug else '' }}">Manage Databases</a>
<span class="oe_footer_seperator"> | </span>
</t>
<a href="https://www.odoo.com" target="_blank">Powered by <span>Odoo</span></a>
</div>
</div>
</t>
</template>
有什么建议吗?
答案 0 :(得分:1)
您已指示Odoo查找并替换类“oe_single_form”的div,但不存在此类div。在我看来,你想要替换“oe_single_form_logo”:
<xpath expr="//div[@class='oe_single_form_logo']" position="replace">
<div class="oe_single_form_logo"><img src="/static/src/img/logo.png'" alt="My Theme Logo" title="My Theme Logo" /></div>
</xpath>