我试图用我自己的设计覆盖odoo 8网站的默认标题部分但是当我使用xpath表达式并进行替换时会出现错误。请参阅以下代码:
header.xml代码
<template id="layout_replace_menu_header" customize_show="True" inherit_id="website.layout" name="custom_header_replace">
<xpath expr="//div[@class='navbar navbar-default navbar-static-top']" position="replace">
<header>
<div class="header">
<div class="container">
<a class="site-logo" href="#"><img src="/themeotb2/static/otbassets/img/logo.png" alt="image" /></a>
<a href="javascript:void(0);" class="mobi-toggler"><i class="fa fa-bars"></i></a>
<!-- BEGIN NAVIGATION -->
<div class="header-navigation pull-right font-transform-inherit">
<ul>
<t t-foreach="website.menu_id.child_id" t-as="submenu">
<li class="dropdown">
<t t-call="website.submenu"/>
</li>
</t>
<!-- BEGIN TOP SEARCH -->
<li class="menu-search">
<span class="sep"></span>
<i class="fa fa-search search-btn"></i>
<div class="search-box">
<form action="#">
<div class="input-group">
<input type="text" placeholder="Search" class="form-control" />
<span class="input-group-btn">
<button class="btn btn-primary" type="submit">Search</button>
</span>
</div>
</form>
</div>
</li>
<!-- END TOP SEARCH -->
</ul>
</div>
<!-- END NAVIGATION -->
</div>
</div>
</header>
</xpath>
</template>
当我使用“inside”而不是替换时,代码将执行,但是当我用错误替换odoo抱怨时:
File "/opt/openerp/ttfa/projectdatabase/src/openerp/models.py", line 1270, in _validate_fields
raise ValidationError('\n'.join(errors))
ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition
Error details:
Element '<xpath expr="//header//a[@class='navbar-brand']">' cannot be located in parent view
Error context:
View `Show Logo`
我该如何解决这个问题?谢谢。
答案 0 :(得分:0)
您必须覆盖模板&#34; layout_logo_show&#34;或禁用&#34;显示徽标&#34;来自网站定制设置。
谢谢!