Inherit sale order report in odoo 10

时间:2017-06-15 09:40:07

标签: openerp odoo-10

I have tried to add a new page beginning of sale order report by inherit and xpath. But it not work. Here is the code:

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

But i edited in core module Sale like below and it works.

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

How can i achieve this in my custom module?

1 个答案:

答案 0 :(得分:0)

Add dependency of "sale" module in your module and try below code

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