diff --git a/account_invoice_report_pagebreak/README.rst b/account_invoice_report_pagebreak/README.rst new file mode 100644 index 000000000..0f40091ca --- /dev/null +++ b/account_invoice_report_pagebreak/README.rst @@ -0,0 +1,90 @@ +========================= +Invoice report page break +========================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoice--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/account-invoice-reporting/tree/14.0/account_invoice_report_pagebreak + :alt: OCA/account-invoice-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-invoice-reporting-14-0/account-invoice-reporting-14-0-account_invoice_report_pagebreak + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/94/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Control Page Breaks in PDF invoice report. + +This split the main table by section and avoid +as much as possible breaking page inside a section. + +**Table of contents** + +.. contents:: + :local: + +Known issues / Roadmap +====================== + +* Gives more controls to end users to allows to force breaking + pages between any rows + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Pierre Verkest + +Contributors +~~~~~~~~~~~~ + +* Pierre Verkest + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-petrus-v| image:: https://github.com/petrus-v.png?size=40px + :target: https://github.com/petrus-v + :alt: petrus-v + +Current `maintainer `__: + +|maintainer-petrus-v| + +This module is part of the `OCA/account-invoice-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_invoice_report_pagebreak/__init__.py b/account_invoice_report_pagebreak/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/account_invoice_report_pagebreak/__manifest__.py b/account_invoice_report_pagebreak/__manifest__.py new file mode 100644 index 000000000..0adbf3b8a --- /dev/null +++ b/account_invoice_report_pagebreak/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2023 CGI37 (https://www.cgi37.com). +# @author Pierre Verkest +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Invoice report page break", + "summary": "Control Page Breaks in PDF invoice report", + "version": "14.0.1.0.0", + "author": "Pierre Verkest, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-invoice-reporting", + "license": "AGPL-3", + "category": "Accounting", + "depends": [ + "account", + "report_qweb_table_pagebreak", + ], + "data": [ + "reports/report_invoice.xml", + ], + "maintainers": ["petrus-v"], +} diff --git a/account_invoice_report_pagebreak/readme/CONTRIBUTORS.rst b/account_invoice_report_pagebreak/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..638be8663 --- /dev/null +++ b/account_invoice_report_pagebreak/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Pierre Verkest diff --git a/account_invoice_report_pagebreak/readme/DESCRIPTION.rst b/account_invoice_report_pagebreak/readme/DESCRIPTION.rst new file mode 100644 index 000000000..f490ab85f --- /dev/null +++ b/account_invoice_report_pagebreak/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +Control Page Breaks in PDF invoice report. + +This split the main table by section and avoid +as much as possible breaking page inside a section. diff --git a/account_invoice_report_pagebreak/readme/ROADMAP.rst b/account_invoice_report_pagebreak/readme/ROADMAP.rst new file mode 100644 index 000000000..677bd990b --- /dev/null +++ b/account_invoice_report_pagebreak/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +* Gives more controls to end users to allows to force breaking + pages between any rows diff --git a/account_invoice_report_pagebreak/reports/report_invoice.xml b/account_invoice_report_pagebreak/reports/report_invoice.xml new file mode 100644 index 000000000..8d31ed34b --- /dev/null +++ b/account_invoice_report_pagebreak/reports/report_invoice.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/account_invoice_report_pagebreak/static/description/index.html b/account_invoice_report_pagebreak/static/description/index.html new file mode 100644 index 000000000..b228f6e18 --- /dev/null +++ b/account_invoice_report_pagebreak/static/description/index.html @@ -0,0 +1,431 @@ + + + + + + +Invoice report page break + + + +
+

Invoice report page break

+ + +

Beta License: AGPL-3 OCA/account-invoice-reporting Translate me on Weblate Try me on Runbot

+

Control Page Breaks in PDF invoice report.

+

This split the main table by section and avoid +as much as possible breaking page inside a section.

+

Table of contents

+ +
+

Known issues / Roadmap

+
    +
  • Gives more controls to end users to allows to force breaking +pages between any rows
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Pierre Verkest
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

petrus-v

+

This module is part of the OCA/account-invoice-reporting project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_invoice_report_pagebreak/tests/__init__.py b/account_invoice_report_pagebreak/tests/__init__.py new file mode 100644 index 000000000..b46aeb690 --- /dev/null +++ b/account_invoice_report_pagebreak/tests/__init__.py @@ -0,0 +1 @@ +from . import test_invoice_report_breakpage diff --git a/account_invoice_report_pagebreak/tests/test_invoice_report_breakpage.py b/account_invoice_report_pagebreak/tests/test_invoice_report_breakpage.py new file mode 100644 index 000000000..bdbe1c899 --- /dev/null +++ b/account_invoice_report_pagebreak/tests/test_invoice_report_breakpage.py @@ -0,0 +1,73 @@ +from lxml import html + +from odoo.tests import tagged +from odoo.tools.image import image_data_uri + +from odoo.addons.account.tests.common import TestAccountReconciliationCommon + + +@tagged("post_install", "-at_install") +class TestInvoiceReportAvoidPageBreakInSection(TestAccountReconciliationCommon): + def setUp(self): + super().setUp() + self.invoice = self.create_invoice_partner() + self.invoice.line_ids.create( + [ + { + "move_id": self.invoice.id, + "name": "Note 1", + "display_type": "line_note", + "sequence": 20, + }, + { + "move_id": self.invoice.id, + "name": "Note 2", + "display_type": "line_note", + "sequence": 40, + }, + ] + ) + + def test_sale_report_with_section(self): + self.invoice.line_ids.create( + [ + { + "move_id": self.invoice.id, + "name": "Section", + "display_type": "line_section", + "sequence": 30, + }, + ] + ) + doc = html.document_fromstring( + self.env["ir.qweb"] + ._render( + "account.report_invoice_document", + values={ + "o": self.invoice, + "env": self.env, + "company": self.env.company, + "image_data_uri": image_data_uri, + }, + ) + .decode("utf-8") + ) + self.assertEqual( + len(doc.find('.//table[@style="page-break-inside: avoid"]')), 2 + ) + + def test_sale_report_without_section(self): + doc = html.document_fromstring( + self.env["ir.qweb"] + ._render( + "account.report_invoice_document", + values={ + "o": self.invoice, + "env": self.env, + "company": self.env.company, + "image_data_uri": image_data_uri, + }, + ) + .decode("utf-8") + ) + self.assertFalse(doc.find('.//table[@style="page-break-inside: avoid"]')) diff --git a/setup/account_invoice_report_pagebreak/odoo/addons/account_invoice_report_pagebreak b/setup/account_invoice_report_pagebreak/odoo/addons/account_invoice_report_pagebreak new file mode 120000 index 000000000..8e5bbae1c --- /dev/null +++ b/setup/account_invoice_report_pagebreak/odoo/addons/account_invoice_report_pagebreak @@ -0,0 +1 @@ +../../../../account_invoice_report_pagebreak \ No newline at end of file diff --git a/setup/account_invoice_report_pagebreak/setup.py b/setup/account_invoice_report_pagebreak/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/account_invoice_report_pagebreak/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..e77de05f8 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo14-addon-report-qweb-table-pagebreak @ git+https://github.com/OCA/reporting-engine.git@refs/pull/826/head#subdirectory=setup/report_qweb_table_pagebreak