1、安装wkhtmltopdf(报告是以PDF文件展现)
2、ODOO中找到相关模型对应的报告(以account.invoice为例)
2、继承修改QWEB模板
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice_document_with_payments1" inherit_id="account.report_invoice_document" >
<xpath expr="//div[@name='invoice_date']" position="after">
<div class="col-auto mw-100 mb-2" t-if="o.bumen" name='部门'>
<strong>部门:</strong>
<p class="m-0" t-field="o.bumen"/>
</div>
<div class="col-auto mw-100 mb-2" t-if="o.invoice_type" name='发票类型'>
<strong>发票类别:</strong>
<p class="m-0" t-field="o.invoice_type"/>
</div>
<div class="col-auto mw-100 mb-2" t-if="o.lyr" name="经办人">
<strong>录入人:</strong>
<p class="m-0" t-field="o.lyr"/>
</div>
</xpath>
</template>
4、xml文件里的挂载
<!-- QWeb Reports -->
<report
id="account_invoices"
model="account.invoice"
string="发票/账单"
report_type="qweb-pdf"
name="account.report_invoice_with_payments"
file="account.report_invoice_with_payments"
attachment="(object.state in ('open','in_payment','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
print_report_name="(object._get_report_base_filename())"
groups="account.group_account_invoice"
/>
<report
id="account_invoices_without_payment"
model="account.invoice"
string="Invoices without Payment"
report_type="qweb-pdf"
name="account.report_invoice"
file="account.report_invoice"
attachment="(object.state in ('open','in_payment','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
print_report_name="(object._get_report_base_filename())"
/>
</odoo>
5、效果: