从现有odoo报告中删除web_external_layout



我想从工资单报告中删除外部页眉和页脚。

我遇到的问题是,在任何报告中,在类为page的div之前,我都不知道有什么钩子可以附加到xpath中。

这是我要取的线。为了简单起见,我刚刚附上了问题所在的代码

提前谢谢。

<template id="report_payslip">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout"> =>this line
<div class="page">
<h2>Pay Slip</h2>
<p t-field="o.name"/>

或者,有没有一种方法可以替换调用此布局的报告,而不必将其删除?一种将其称为我的自定义报告的方法。

<report 
id="action_report_payslip" 
model="hr.payslip" 
string="Payslip"
report_type="qweb-pdf"
name="hr_payroll.report_payslip" 
file="hr_payroll.report_payslip"
print_report_name="'Payslip - %s' % (object.employee_id.name)"
/>

要删除或修改模板的内容,需要继承它。示例:

<odoo>
<template id="external_layout_inherited" inherit_id="web.external_layout">
<xpath expr="//div[hasclass('header')]" position="replace">
</xpath>
</template>
</odoo>

在上面的代码中,它替换了外部模板的头。

您可以查看dev-doc了解更多信息。

相关内容

最新更新