Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5524 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Yenthe the below snippet worked fine
Hope this helps 

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 24
1758
2
thg 5 24
3475
3
thg 2 24
2968
2
thg 11 22
5832
0
thg 4 24
1688