Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0] [ADD] report_wkhtmltopdf_paperformat_from_template #859

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

ivantodorovich
Copy link
Contributor

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>

@ivantodorovich ivantodorovich force-pushed the 16.0-add-paperformat-from-template branch 2 times, most recently from 9456186 to b0f33e3 Compare February 29, 2024 15:56
@ivantodorovich ivantodorovich force-pushed the 16.0-add-paperformat-from-template branch from b0f33e3 to 764329a Compare February 29, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant