跳至內容
選單
此問題已被標幟
2 回覆
4990 瀏覽次數

Hi there,


Does anybody know a clean way to create one PDF report from two QWeb reports in Odoo?


I'd like to combine a QWeb report from the model "sale.order" and one from "account.move" to generate one PDF from two QWeb reports and two models. My idea was to create a custom QWeb report for the "sale.order" part and then doing a t-call in QWeb to call a second report but this does not seem to work. Here's the code snippet:

<template id="report_delivery_note_document">
    <t t-call="sale_order_endpoint.external_layout">
        <t t-set="doc" t-value="doc.with_context(lang=lang)"/>
        <div class="page">
            <p>Loads of QWeb code here</p>
        </div>
        <t t-if="doc.invoice_ids">
            <t t-set="o" t-value="doc.invoice_ids[0]"/>
            <t t-call="account.report_invoice_document"/>
        </t>
     </t>
</template>

However this method has two issues (which already tell me this is not a good way or idea).
Odoo prevents doing this kind of behaviour with https://github.com/odoo/odoo/blob/5e85ee521edb70d4d2c7cdbf59c29794a8cd98b9/odoo/addons/base/models/ir_actions_report.py#L779-L781 and if you'd even override this so it is allowed (which would modify the core and is not a good idea) then the invoice PDF is injected twice too.

Does anybody have a good solution for this? In short I need the default invoice PDF to be inserted/added into my custom QWeb report.


Regards,
Yenthe

頭像
捨棄
最佳答案

Hi Yenthe the below snippet worked fine
Hope this helps 

頭像
捨棄

<template id="report_saleorder">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="sale.report_saleorder_document" t-lang="doc.partner_id.lang"/>
</t>
<t t-call="account.report_invoice_odinvoice">
<t t-set="docs" t-value="docs.invoice_ids[0]"/>
</t>
</t>
</template>

最佳答案

Hey , see if this help you in someway

https://www.odoo.com/forum/help-1/how-to-generate-a-single-pdf-of-multiple-reports-of-the-same-template-133486

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
5月 24
1134
2
5月 24
2519
3
2月 24
2253
2
11月 22
5051
0
4月 24
1071