diff --git a/sale_order_report_hide_tax/README.rst b/sale_order_report_hide_tax/README.rst new file mode 100644 index 000000000..7fbd7844e --- /dev/null +++ b/sale_order_report_hide_tax/README.rst @@ -0,0 +1,120 @@ +================================== +Sale order line hide tax in report +================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:c3f8c634c1fae23b76f78082b36599f63225f7b3b09f33d3e5fa90f5b185f557 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/sale-reporting/tree/18.0/sale_order_report_hide_tax + :alt: OCA/sale-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-reporting-18-0/sale-reporting-18-0-sale_order_report_hide_tax + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/sale-reporting&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Hide taxes column in the quotation document that is sent to the +customer. When all quotation lines have the same tax group, the Taxes +column is automatically hidden to avoid displaying redundant information +and to improve document clarity. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +When the taxes are the same in every sales line, that information might +be redundant with the taxes summary and takes valuable space that other +columns might take. + +This might be event more annoying when there's tax exemptions like in EU +intracomunitary operations. + +Usage +===== + +Whenever the taxes are in the same group for the whole order the column +won't be displayed. + +The module performs the following validation: - It checks that all order +lines have the same tax group. - It does not validate if the taxes +within the same line are different. + +**Result:** - If all tax groups are the same, the Taxes column is hidden +in the printed or sent quotation. - If at least one line has a different +tax group, the Taxes column is displayed as usual. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Moduon + +Contributors +------------ + +- David Vidal (`Moduon `__) +- Sabrina Rodriguez (`Moduon `__) + +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-chienandalu| image:: https://github.com/chienandalu.png?size=40px + :target: https://github.com/chienandalu + :alt: chienandalu +.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px + :target: https://github.com/rafaelbn + :alt: rafaelbn + +Current `maintainers `__: + +|maintainer-chienandalu| |maintainer-rafaelbn| + +This module is part of the `OCA/sale-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_order_report_hide_tax/__init__.py b/sale_order_report_hide_tax/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/sale_order_report_hide_tax/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_order_report_hide_tax/__manifest__.py b/sale_order_report_hide_tax/__manifest__.py new file mode 100644 index 000000000..d54e575d9 --- /dev/null +++ b/sale_order_report_hide_tax/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2025 Moduon Team S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) +{ + "name": "Sale order line hide tax in report", + "summary": "Hide taxes column when they don't add value", + "version": "18.0.1.0.1", + "development_status": "Alpha", + "category": "Sales", + "website": "https://github.com/OCA/sale-reporting", + "author": "Moduon, Odoo Community Association (OCA)", + "maintainers": ["chienandalu", "rafaelbn"], + "license": "LGPL-3", + "depends": ["sale"], + "data": [ + "reports/sale_order_report_template.xml", + ], +} diff --git a/sale_order_report_hide_tax/i18n/it.po b/sale_order_report_hide_tax/i18n/it.po new file mode 100644 index 000000000..d7f4c2c7f --- /dev/null +++ b/sale_order_report_hide_tax/i18n/it.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_report_hide_tax +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-10-22 07:34+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.10.4\n" + +#. module: sale_order_report_hide_tax +#: model:ir.model,name:sale_order_report_hide_tax.model_sale_order +msgid "Sales Order" +msgstr "Ordine di vendita" + +#. module: sale_order_report_hide_tax +#: model:ir.model.fields,field_description:sale_order_report_hide_tax.field_sale_order__show_tax_column_in_report +msgid "Show Tax Column In Report" +msgstr "Visualizza colonna imposta nel resoconto" diff --git a/sale_order_report_hide_tax/i18n/sale_order_report_hide_tax.pot b/sale_order_report_hide_tax/i18n/sale_order_report_hide_tax.pot new file mode 100644 index 000000000..1a243e05f --- /dev/null +++ b/sale_order_report_hide_tax/i18n/sale_order_report_hide_tax.pot @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_report_hide_tax +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: sale_order_report_hide_tax +#: model:ir.model,name:sale_order_report_hide_tax.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_order_report_hide_tax +#: model:ir.model.fields,field_description:sale_order_report_hide_tax.field_sale_order__show_tax_column_in_report +msgid "Show Tax Column In Report" +msgstr "" diff --git a/sale_order_report_hide_tax/models/__init__.py b/sale_order_report_hide_tax/models/__init__.py new file mode 100644 index 000000000..6aacb7531 --- /dev/null +++ b/sale_order_report_hide_tax/models/__init__.py @@ -0,0 +1 @@ +from . import sale_order diff --git a/sale_order_report_hide_tax/models/sale_order.py b/sale_order_report_hide_tax/models/sale_order.py new file mode 100644 index 000000000..8092b68bb --- /dev/null +++ b/sale_order_report_hide_tax/models/sale_order.py @@ -0,0 +1,21 @@ +# Copyright 2025 Moduon Team S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) +from odoo import fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + show_tax_column_in_report = fields.Boolean( + compute="_compute_show_tax_column_in_report" + ) + + def _compute_show_tax_column_in_report(self): + self.show_tax_column_in_report = True + for order in self.filtered("order_line"): + order_lines = order.order_line.filtered(lambda x: not x.display_type) + first_line_tax_group = fields.first(order_lines).tax_id.tax_group_id + # Mixed group taxes, let's show them for clarity + order.show_tax_column_in_report = any( + first_line_tax_group != line.tax_id.tax_group_id for line in order_lines + ) diff --git a/sale_order_report_hide_tax/pyproject.toml b/sale_order_report_hide_tax/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/sale_order_report_hide_tax/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sale_order_report_hide_tax/readme/CONTEXT.md b/sale_order_report_hide_tax/readme/CONTEXT.md new file mode 100644 index 000000000..e19882e73 --- /dev/null +++ b/sale_order_report_hide_tax/readme/CONTEXT.md @@ -0,0 +1,5 @@ +When the taxes are the same in every sales line, that information might be redundant +with the taxes summary and takes valuable space that other columns might take. + +This might be event more annoying when there's tax exemptions like in EU intracomunitary +operations. diff --git a/sale_order_report_hide_tax/readme/CONTRIBUTORS.md b/sale_order_report_hide_tax/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..9555d5fed --- /dev/null +++ b/sale_order_report_hide_tax/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- David Vidal ([Moduon](https://www.moduon.team/)) +- Sabrina Rodriguez ([Moduon](https://www.moduon.team/)) diff --git a/sale_order_report_hide_tax/readme/DESCRIPTION.md b/sale_order_report_hide_tax/readme/DESCRIPTION.md new file mode 100644 index 000000000..1b7cdd1e0 --- /dev/null +++ b/sale_order_report_hide_tax/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +Hide taxes column in the quotation document that is sent to the customer. +When all quotation lines have the same tax group, the Taxes column is automatically hidden to avoid displaying redundant information and to improve document clarity. \ No newline at end of file diff --git a/sale_order_report_hide_tax/readme/USAGE.md b/sale_order_report_hide_tax/readme/USAGE.md new file mode 100644 index 000000000..f0959970e --- /dev/null +++ b/sale_order_report_hide_tax/readme/USAGE.md @@ -0,0 +1,10 @@ +Whenever the taxes are in the same group for the whole order the column won't be +displayed. + +The module performs the following validation: + - It checks that all order lines have the same tax group. + - It does not validate if the taxes within the same line are different. + +**Result:** + - If all tax groups are the same, the Taxes column is hidden in the printed or sent quotation. + - If at least one line has a different tax group, the Taxes column is displayed as usual. \ No newline at end of file diff --git a/sale_order_report_hide_tax/reports/sale_order_report_template.xml b/sale_order_report_hide_tax/reports/sale_order_report_template.xml new file mode 100644 index 000000000..10492c07a --- /dev/null +++ b/sale_order_report_hide_tax/reports/sale_order_report_template.xml @@ -0,0 +1,23 @@ + + + + diff --git a/sale_order_report_hide_tax/static/description/icon.png b/sale_order_report_hide_tax/static/description/icon.png new file mode 100644 index 000000000..1dcc49c24 Binary files /dev/null and b/sale_order_report_hide_tax/static/description/icon.png differ diff --git a/sale_order_report_hide_tax/static/description/index.html b/sale_order_report_hide_tax/static/description/index.html new file mode 100644 index 000000000..3540e4063 --- /dev/null +++ b/sale_order_report_hide_tax/static/description/index.html @@ -0,0 +1,456 @@ + + + + + +Sale order line hide tax in report + + + +
+

Sale order line hide tax in report

+ + +

Alpha License: LGPL-3 OCA/sale-reporting Translate me on Weblate Try me on Runboat

+

Hide taxes column in the quotation document that is sent to the +customer. When all quotation lines have the same tax group, the Taxes +column is automatically hidden to avoid displaying redundant information +and to improve document clarity.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Use Cases / Context

+

When the taxes are the same in every sales line, that information might +be redundant with the taxes summary and takes valuable space that other +columns might take.

+

This might be event more annoying when there’s tax exemptions like in EU +intracomunitary operations.

+
+
+

Usage

+

Whenever the taxes are in the same group for the whole order the column +won’t be displayed.

+

The module performs the following validation: - It checks that all order +lines have the same tax group. - It does not validate if the taxes +within the same line are different.

+

Result: - If all tax groups are the same, the Taxes column is hidden +in the printed or sent quotation. - If at least one line has a different +tax group, the Taxes column is displayed as usual.

+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Moduon
  • +
+
+
+

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 maintainers:

+

chienandalu rafaelbn

+

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

+

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

+
+
+
+ + diff --git a/sale_order_report_hide_tax/tests/__init__.py b/sale_order_report_hide_tax/tests/__init__.py new file mode 100644 index 000000000..bb1d2accc --- /dev/null +++ b/sale_order_report_hide_tax/tests/__init__.py @@ -0,0 +1 @@ +from . import test_show_tax_column diff --git a/sale_order_report_hide_tax/tests/test_show_tax_column.py b/sale_order_report_hide_tax/tests/test_show_tax_column.py new file mode 100644 index 000000000..ffac2bdfb --- /dev/null +++ b/sale_order_report_hide_tax/tests/test_show_tax_column.py @@ -0,0 +1,161 @@ +# Copyright 2025 Moduon Team S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) +from odoo import Command + +from odoo.addons.base.tests.common import BaseCommon + + +class TestShowTaxColumnInReport(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner = cls.env["res.partner"].create( + { + "name": "Test Partner", + } + ) + cls.product = cls.env["product.product"].create( + { + "name": "Test Product", + } + ) + cls.tax_group_1 = cls.env["account.tax.group"].create( + { + "name": "VAT Group 1", + } + ) + cls.tax_group_2 = cls.env["account.tax.group"].create( + { + "name": "VAT Group 2", + } + ) + cls.tax_group_3 = cls.env["account.tax.group"].create( + { + "name": "VAT Group 3", + } + ) + cls.tax_1 = cls.env["account.tax"].create( + { + "name": "Tax 1", + "amount": 10, + "amount_type": "percent", + "tax_group_id": cls.tax_group_1.id, + } + ) + cls.tax_2 = cls.env["account.tax"].create( + { + "name": "Tax 2", + "amount": 5, + "amount_type": "percent", + "tax_group_id": cls.tax_group_2.id, + } + ) + cls.tax_3 = cls.env["account.tax"].create( + { + "name": "Tax 3", + "amount": 5, + "amount_type": "percent", + "tax_group_id": cls.tax_group_2.id, + } + ) + cls.order = cls.env["sale.order"].create( + { + "partner_id": cls.partner.id, + } + ) + cls.report = cls.env["ir.actions.report"]._get_report_from_name( + "sale.report_saleorder" + ) + + def test_same_tax_group_hides_tax_column(self): + self.order.order_line = [ + Command.clear(), + Command.create( + { + "product_id": self.product.id, + "name": "Line 1", + "product_uom_qty": 1, + "price_unit": 100, + "tax_id": [(6, 0, [self.tax_1.id])], + } + ), + Command.create( + { + "product_id": self.product.id, + "name": "Line 2", + "product_uom_qty": 1, + "price_unit": 50, + "tax_id": [(6, 0, [self.tax_1.id])], + } + ), + ] + result = self.report._render_qweb_html("sale.report_saleorder", [self.order.id]) + html = result[0].decode("utf-8") + self.assertNotIn( + "Taxes", + html, + """Tax column should be hidden when all taxes + belong to the same tax group""", + ) + + def test_mixed_tax_groups_show_tax_column(self): + self.order.order_line = [ + Command.clear(), + Command.create( + { + "product_id": self.product.id, + "name": "Line 1", + "product_uom_qty": 1, + "price_unit": 100, + "tax_id": [(6, 0, [self.tax_1.id])], + } + ), + Command.create( + { + "product_id": self.product.id, + "name": "Line 2", + "product_uom_qty": 1, + "price_unit": 50, + "tax_id": [(6, 0, [self.tax_2.id])], + } + ), + ] + result = self.report._render_qweb_html("sale.report_saleorder", [self.order.id]) + html = result[0].decode("utf-8") + self.assertIn( + "Taxes", + html, + """The tax column should be displayed when taxes + belong to different tax groups""", + ) + + def test_mixed_tax_groups_single_line_sow_tax_column(self): + self.order.order_line = [ + Command.clear(), + Command.create( + { + "product_id": self.product.id, + "name": "Line 1", + "product_uom_qty": 1, + "price_unit": 100, + "tax_id": [(6, 0, [self.tax_1.id, self.tax_2.id])], + } + ), + Command.create( + { + "product_id": self.product.id, + "name": "Line 1", + "product_uom_qty": 1, + "price_unit": 100, + "tax_id": [(6, 0, [self.tax_3.id])], + } + ), + ] + result = self.report._render_qweb_html("sale.report_saleorder", [self.order.id]) + html = result[0].decode("utf-8") + self.assertIn( + "Taxes", + html, + """The tax column should be displayed when taxes + belong to different tax groups""", + )