Skip to content

Commit 41951fd

Browse files
committed
[ADD] sale_order_line_no_print: new module
MT-9255
1 parent a3cd8d4 commit 41951fd

File tree

17 files changed

+767
-0
lines changed

17 files changed

+767
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
================================
2+
Sale order line hidden in report
3+
================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:a03ee690d8ef56078c0373a096d2e5494611e4ea80869c08c66dae8d266c24ca
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Alpha
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/sale-workflow/tree/16.0/sale_order_line_no_print
21+
:alt: OCA/sale-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_order_line_no_print
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows to hide some order lines from the reports and portal
32+
views that the final customer has access to.
33+
34+
.. IMPORTANT::
35+
This is an alpha version, the data model and design can change at any time without warning.
36+
Only for development or testing purpose, do not use in production.
37+
`More details on development status <https://odoo-community.org/page/development-status>`_
38+
39+
**Table of contents**
40+
41+
.. contents::
42+
:local:
43+
44+
Use Cases / Context
45+
===================
46+
47+
In some ocassions the salesman wants to hide some info that's no
48+
relevant for the customer but that it's needed for other documents
49+
(delivery info, pack items, etc.) as they don't want to disclose some
50+
strategic data to the competence.
51+
52+
Usage
53+
=====
54+
55+
To hide sale lines from the report:
56+
57+
- Go to a sales order/quotation/invoice.
58+
- In the lines, click on the column selector to reveal the *Display in
59+
report* column.
60+
- Toggle it on or off depending on your will.
61+
- Go to the portal view: you won't see those hidden lines.
62+
63+
Bug Tracker
64+
===========
65+
66+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
67+
In case of trouble, please check there if your issue has already been reported.
68+
If you spotted it first, help us to smash it by providing a detailed and welcomed
69+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_line_no_print%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
70+
71+
Do not contact contributors directly about support or help with technical issues.
72+
73+
Credits
74+
=======
75+
76+
Authors
77+
-------
78+
79+
* Moduon
80+
81+
Contributors
82+
------------
83+
84+
- David Vidal (`Moduon <https://www.moduon.team/>`__)
85+
- Jairo Llopis (`Moduon <https://www.moduon.team/>`__)
86+
87+
Maintainers
88+
-----------
89+
90+
This module is maintained by the OCA.
91+
92+
.. image:: https://odoo-community.org/logo.png
93+
:alt: Odoo Community Association
94+
:target: https://odoo-community.org
95+
96+
OCA, or the Odoo Community Association, is a nonprofit organization whose
97+
mission is to support the collaborative development of Odoo features and
98+
promote its widespread use.
99+
100+
.. |maintainer-chienandalu| image:: https://github.com/chienandalu.png?size=40px
101+
:target: https://github.com/chienandalu
102+
:alt: chienandalu
103+
.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px
104+
:target: https://github.com/rafaelbn
105+
:alt: rafaelbn
106+
107+
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
108+
109+
|maintainer-chienandalu| |maintainer-rafaelbn|
110+
111+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/16.0/sale_order_line_no_print>`_ project on GitHub.
112+
113+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2025 Moduon Team S.L.
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)
3+
{
4+
"name": "Sale order line hidden in report",
5+
"summary": "Hide order lines in reports",
6+
"version": "16.0.1.0.0",
7+
"development_status": "Alpha",
8+
"category": "Sales/Sales",
9+
"website": "https://github.com/OCA/sale-workflow",
10+
"author": "Moduon, Odoo Community Association (OCA)",
11+
"maintainers": ["chienandalu", "rafaelbn"],
12+
"license": "LGPL-3",
13+
"depends": ["sale"],
14+
"data": [
15+
"views/report_invoice_document.xml",
16+
"views/report_saleorder_document.xml",
17+
"views/account_move_views.xml",
18+
"views/sale_order_views.xml",
19+
],
20+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import account_move
2+
from . import sale_order
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2025 Moduon Team S.L.
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)
3+
from odoo import fields, models
4+
5+
6+
class AccountMoveLine(models.Model):
7+
_inherit = "account.move.line"
8+
9+
display_in_report = fields.Boolean(
10+
default=True,
11+
help="Disable it to hide it in the invoice reports that customer sees",
12+
)
13+
14+
def _compute_totals(self):
15+
res = super()._compute_totals()
16+
# Avoid hiding lines with any amount
17+
self.filtered(
18+
lambda line: line.price_total and not line.display_in_report
19+
).display_in_report = True
20+
return res
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2025 Moduon Team S.L.
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)
3+
from odoo import fields, models
4+
5+
6+
class SaleOrderLine(models.Model):
7+
_inherit = "sale.order.line"
8+
9+
display_in_report = fields.Boolean(
10+
default=True,
11+
help="Disable it to hide it in the quotations/sale orders that customer sees",
12+
)
13+
14+
def _prepare_invoice_line(self, **optional_values):
15+
res = super()._prepare_invoice_line(**optional_values)
16+
res["display_in_report"] = self.display_in_report
17+
return res
18+
19+
def _compute_amount(self):
20+
res = super()._compute_amount()
21+
# Avoid hiding lines with any amount
22+
self.filtered(
23+
lambda line: line.price_total and not line.display_in_report
24+
).display_in_report = True
25+
return res
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
In some ocassions the salesman wants to hide some info that's no relevant for the
2+
customer but that it's needed for other documents (delivery info, pack items, etc.) as
3+
they don't want to disclose some strategic data to the competence.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- David Vidal ([Moduon](https://www.moduon.team/))
2+
- Jairo Llopis ([Moduon](https://www.moduon.team/))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This module allows to hide some order lines from the reports and portal views
2+
that the final customer has access to.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
To hide sale lines from the report:
2+
3+
- Go to a sales order/quotation/invoice.
4+
- In the lines, click on the column selector to reveal the *Display in report* column.
5+
- Toggle it on or off depending on your will.
6+
- Go to the portal view: you won't see those hidden lines.

0 commit comments

Comments
 (0)