在 Odoo qweb 报告中添加 xpath

Poi*_*ter 1 odoo qweb

如何在原报告中的最后一段后继承 qweb 添加新元素:

<p t-if="o.comment">
    <strong>Comment:</strong>
    <span t-field="o.comment"/>
</p>

//add after <p t-if="o.comment">
<xpath expr="??" position="after">
     <p>new</p>
</xpath>
Run Code Online (Sandbox Code Playgroud)

小智 6

确保继承模板 id 如下,然后添加您的 xpath。希望这对你有帮助。

<template id="report_saleorder_inherit" inherit_id="report.external_layout_footer">
    <xpath expr="//p[@t-if='o.comment']" position="after">
        <p>new</p>
    </xpath>
</template>
Run Code Online (Sandbox Code Playgroud)