تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
4945 أدوات العرض

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
مايو 24
1028
2
مايو 24
2415
3
فبراير 24
2146
2
نوفمبر 22
4949
0
أبريل 24
974