2017-06-15 76 views
0

我試圖通過繼承和xpath添加銷售訂單報告的新頁面。但它不起作用。 下面是代碼:在odoo 10中繼承銷售訂單報告

<template id="report_saleorder_inherit" inherit_id="sale.report_saleorder"> 
<xpath expr="//t[@t-call='report.html_container']" position="before"> 
    <t t-call="report.html_container"> 
    <t t-call="report.external_layout"> 
     <div class="page"> 
     <h1>New Page</h1> 
     </div> 
    </t> 
    </t> 
</xpath> 

但我核心模塊Sale在編輯像下面和它的作品。

<template id="report_saleorder"> 
    <t t-call="report.html_container"> 
    <t t-call="report.external_layout"> 
     <div class="page"> 
      <h1>New Page</h1> 
     </div> 
    </t> 
    </t> 
<t t-call="report.html_container"> 
    <t t-foreach="docs" t-as="doc"> 
    <t t-call="sale.report_saleorder_document" t- 
     lang="doc.partner_id.lang"/> 
    </t> 
</t> 
</template> 

如何在我的自定義模塊中實現此目的?

回答

0

添加您的模塊在「銷售」模塊的依賴關係,並嘗試下面的代碼

<template id="report_saleorder_inherit" inherit_id="sale.report_saleorder"> 
<xpath expr="t" position="before"> 
    <t t-call="report.html_container"> 
     <t t-call="report.external_layout"> 
      <div class="page"> 
      <h1>New Page</h1> 
      </div> 
     </t> 
     </t> 
</xpath> 
</template>