Maintainers
+Maintainers
This module is maintained by the OCA.
@@ -454,6 +449,5 @@ diff --git a/sale_order_line_no_print/README.rst b/sale_order_line_no_print/README.rst index 0c2de50ec1a..93757baac2d 100644 --- a/sale_order_line_no_print/README.rst +++ b/sale_order_line_no_print/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ================================ Sale order line hidden in report ================================ @@ -17,7 +13,7 @@ Sale order line hidden in report .. |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/license-LGPL--3-blue.png +.. |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--workflow-lightgray.png?logo=github diff --git a/sale_order_line_no_print/__init__.py b/sale_order_line_no_print/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/sale_order_line_no_print/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_order_line_no_print/__manifest__.py b/sale_order_line_no_print/__manifest__.py new file mode 100644 index 00000000000..ebf1cf125c2 --- /dev/null +++ b/sale_order_line_no_print/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2025 Moduon Team S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) +{ + "name": "Sale order line hidden in report", + "summary": "Hide order lines in reports", + "version": "16.0.1.0.0", + "development_status": "Alpha", + "category": "Sales/Sales", + "website": "https://github.com/OCA/sale-workflow", + "author": "Moduon, Odoo Community Association (OCA)", + "maintainers": ["chienandalu", "rafaelbn"], + "license": "LGPL-3", + "depends": ["sale"], + "data": [ + "views/report_invoice_document.xml", + "views/report_saleorder_document.xml", + "views/account_move_views.xml", + "views/sale_order_views.xml", + ], +} diff --git a/sale_order_line_no_print/models/__init__.py b/sale_order_line_no_print/models/__init__.py new file mode 100644 index 00000000000..df48fd83043 --- /dev/null +++ b/sale_order_line_no_print/models/__init__.py @@ -0,0 +1,2 @@ +from . import account_move +from . import sale_order diff --git a/sale_order_line_no_print/models/account_move.py b/sale_order_line_no_print/models/account_move.py new file mode 100644 index 00000000000..38b61138fe3 --- /dev/null +++ b/sale_order_line_no_print/models/account_move.py @@ -0,0 +1,20 @@ +# 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 AccountMoveLine(models.Model): + _inherit = "account.move.line" + + display_in_report = fields.Boolean( + default=True, + help="Disable it to hide it in the invoice reports that customer sees", + ) + + def _compute_totals(self): + res = super()._compute_totals() + # Avoid hiding lines with any amount + self.filtered( + lambda line: line.price_total and not line.display_in_report + ).display_in_report = True + return res diff --git a/sale_order_line_no_print/models/sale_order.py b/sale_order_line_no_print/models/sale_order.py new file mode 100644 index 00000000000..9d43e3c129e --- /dev/null +++ b/sale_order_line_no_print/models/sale_order.py @@ -0,0 +1,25 @@ +# 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 SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + display_in_report = fields.Boolean( + default=True, + help="Disable it to hide it in the quotations/sale orders that customer sees", + ) + + def _prepare_invoice_line(self, **optional_values): + res = super()._prepare_invoice_line(**optional_values) + res["display_in_report"] = self.display_in_report + return res + + def _compute_amount(self): + res = super()._compute_amount() + # Avoid hiding lines with any amount + self.filtered( + lambda line: line.price_total and not line.display_in_report + ).display_in_report = True + return res diff --git a/sale_order_line_no_print/readme/CONTEXT.md b/sale_order_line_no_print/readme/CONTEXT.md new file mode 100644 index 00000000000..737ffcc9be5 --- /dev/null +++ b/sale_order_line_no_print/readme/CONTEXT.md @@ -0,0 +1,3 @@ +In some ocassions the salesman wants to hide some info that's no relevant for the +customer but that it's needed for other documents (delivery info, pack items, etc.) as +they don't want to disclose some strategic data to the competence. diff --git a/sale_order_line_no_print/readme/CONTRIBUTORS.md b/sale_order_line_no_print/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..bd388df6c13 --- /dev/null +++ b/sale_order_line_no_print/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- David Vidal ([Moduon](https://www.moduon.team/)) +- Jairo Llopis ([Moduon](https://www.moduon.team/)) diff --git a/sale_order_line_no_print/readme/DESCRIPTION.md b/sale_order_line_no_print/readme/DESCRIPTION.md new file mode 100644 index 00000000000..a907a3b6260 --- /dev/null +++ b/sale_order_line_no_print/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module allows to hide some order lines from the reports and portal views +that the final customer has access to. diff --git a/sale_order_line_no_print/readme/USAGE.md b/sale_order_line_no_print/readme/USAGE.md new file mode 100644 index 00000000000..377804d867e --- /dev/null +++ b/sale_order_line_no_print/readme/USAGE.md @@ -0,0 +1,6 @@ +To hide sale lines from the report: + +- Go to a sales order/quotation/invoice. +- In the lines, click on the column selector to reveal the *Display in report* column. +- Toggle it on or off depending on your will. +- Go to the portal view: you won't see those hidden lines. diff --git a/sale_order_line_no_print/static/description/index.html b/sale_order_line_no_print/static/description/index.html index d1ecf673c59..ee7dcac7193 100644 --- a/sale_order_line_no_print/static/description/index.html +++ b/sale_order_line_no_print/static/description/index.html @@ -3,7 +3,7 @@
-