OCA / reporting-engine

Odoo Alternative Reporting Engine
https://odoo-community.org/project/tools-maintainers-30
GNU Affero General Public License v3.0
335 stars 795 forks source link

[16.0] [ADD] report_wkhtmltopdf_paperformat_from_template #859

Closed ivantodorovich closed 3 months ago

ivantodorovich commented 8 months ago

This is a technical module that allows to force a paperformat directly from the report QWeb template definition.

This is useful in situations where the report content is dynamically chosen, depending on some record conditions, and a different paperformat needs to be used for each.

In core, Odoo already allows to overwrite some paperformat values like the margin-top, header-spacing, etc.. through special data-report-* attributes in the root html tag of the report QWeb template. This module extends this feature to allow to overwrite the paperformat itself.


In a report QWeb template, set the data_report_paperformat variable to the desired paperformat xmlid.

For example:

    <template id="report_invoice" inherit_id="account.report_invoice">
        <xpath expr="//t[@t-call='web.html_container']" position="before">
            <t t-set="data_report_paperformat">my_module.paperformat_custom</t>
        </xpath>
    </template>
github-actions[bot] commented 4 months ago

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.