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