2016-02-17 50 views
0

我試圖用我自己的設計來覆蓋odoo 8網站的默認標題部分,但當我使用xpath表達式時發生錯誤並進行替換。請參見下面的代碼:如何覆蓋默認的odoo 8網站標題部分

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> 

當我使用「內部」,而不是替換代碼會執行,但是當我做替代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

要麼你必須重寫模板「layout_logo_show」或禁用「顯示標誌」從網站自定義設置。

謝謝!

+0

謝謝。讓我測試會恢復 –