Skip to Content

Contributors

Re: Sale/invoice report break page

Hi there,

tl;dr: 3 new PRs to reviews to get more control on page breaks in sales/invoices PDF report

* report_qweb_table_pagebreak: https://github.com/OCA/reporting-engine/pull/826:
  Control Page Breaks in `<table>`'s within QWeb Reports

  The primary objective of this module is to prevent tables
  from being split arbitrarily and to provide better control
  over page breaks within tables.

  Avoid break page inside sections on sale PDF report

  Avoid break page inside sections on invoice PDF report

On the way to create those modules I got few challenges to I change a bit the behaviour on this first version

* `page-break-[before|afeter|inside]` only applies on block elements which `<tr>` aren't by default, that why
   the first PR `report_qweb_table_pagebreak` is splitting table and manage page break at <table> level
* adding new kind of line (like note or section) on sale order line or account move line would be the best
   behaviour I would implement as expected behaviour for end user but I'm a bit scared about the impact
   on existing code to ignore those lines so I forgot that idea (I haven't test to be honest)
* adding a boolean field on sale order line is pretty straightforward except for section where we should implement
  a widget to allow to manage the attribute from the form view

So I end up with this first solution which will try to avoid breaking pages inside each section which could be improved
later to give even more control.


Cheers,

Le mer. 15 nov. 2023 à 19:52, Tom Blauwendraat <notifications@odoo-community.org> a écrit :

Hey Pierre,

only thing I know is that it's possible to manually add "page-break-before: always;" to certain elements. So once you know how many rows fit on a page, you could adjust the QWEB generation to add page breaks at the right places. This doesn't take into account page margins however, so probably your way is better.

-Tom

On 11/15/23 11:38, Pierre Verkest wrote:
Dear community,

One of my customers using odoo 14.0 needs to get the control where page breaks appear in pdf reports on quotations and invoice documents.

Do you know any existing modules to do that ?

As sections are table rows it's not as easy to add a page-break-inside: avoid; on a html block and would not fit all corner cases. So I'm going to add a link button (such as the add section) that will add a new kind of row to manage the break page in reports.

This probably ends up with 3 modules:

base_breakpage in oca/reporting-engine
sale_report_breakpage in oca/sale-reporting
account_invoice_report_breakpage in oca/account-invoice-reporting

Any hints on that ?
regards

--
Pierre Verkest
06 81 12 25 20
Github: petrus-v - Linkedin: pierre-verkest

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe



--
Pierre

by Pierre Verkest - 06:11 - 13 Dec 2023

Reference

  • Sale/invoice report break page
    Dear community,

    One of my customers using odoo 14.0 needs to get the control where page breaks appear in pdf reports on quotations and invoice documents.

    Do you know any existing modules to do that ?

    As sections are table rows it's not as easy to add a page-break-inside: avoid; on a html block and would not fit all corner cases. So I'm going to add a link button (such as the add section) that will add a new kind of row to manage the break page in reports.

    This probably ends up with 3 modules:

    base_breakpage in oca/reporting-engine
    sale_report_breakpage in oca/sale-reporting
    account_invoice_report_breakpage in oca/account-invoice-reporting

    Any hints on that ?
    regards

    --
    Pierre Verkest
    06 81 12 25 20
    Github: petrus-v - Linkedin: pierre-verkest

    by Pierre Verkest - 11:36 - 15 Nov 2023