Skip to content

Commit 829bee8

Browse files
[MIG] sale_report_delivered_volume: Migration to 17.0
1 parent d63c9ac commit 829bee8

6 files changed

Lines changed: 81 additions & 1 deletion

File tree

sale_report_delivered_volume/README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Contributors
6868
- Carlos Roca
6969
- Carolina Fernandez
7070

71+
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
72+
7173
Maintainers
7274
-----------
7375

sale_report_delivered_volume/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{
66
"name": "Sale Report Delivered Volume",
7-
"version": "16.0.1.0.0",
7+
"version": "17.0.1.0.0",
88
"author": "Tecnativa, Odoo Community Association (OCA)",
99
"category": "Sales",
1010
"development_status": "Production/Stable",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
- [Tecnativa](https://www.tecnativa.com):
22
- Carlos Roca
33
- Carolina Fernandez
4+
- \[Heliconia Solutions Pvt. Ltd.\](<https://www.heliconia.io>)

sale_report_delivered_volume/static/description/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
416416
<li>Carolina Fernandez</li>
417417
</ul>
418418
</li>
419+
<li>[Heliconia Solutions Pvt. Ltd.](<a class="reference external" href="https://www.heliconia.io">https://www.heliconia.io</a>)</li>
419420
</ul>
420421
</div>
421422
<div class="section" id="maintainers">
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import test_sale_report_delivered_volume
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Copyright 2022 Tecnativa - Carlos Roca
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo.tests.common import TransactionCase
5+
6+
7+
class TestSaleReportDeliveredVolume(TransactionCase):
8+
@classmethod
9+
def setUpClass(cls):
10+
super().setUpClass()
11+
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
12+
cls.partner = cls.env.ref("base.res_partner_12")
13+
cls.product = cls.env.ref("product.product_product_9")
14+
15+
# Create a sale order with order lines
16+
cls.order = cls.env["sale.order"].create(
17+
{
18+
"partner_id": cls.partner.id,
19+
"order_line": [
20+
(
21+
0,
22+
0,
23+
{
24+
"product_id": cls.product.id,
25+
"product_uom": cls.product.uom_id.id,
26+
"product_uom_qty": 3.0,
27+
"qty_delivered": 2.0,
28+
},
29+
),
30+
(0, 0, {"display_type": "line_section", "name": "Section"}),
31+
(
32+
0,
33+
0,
34+
{
35+
"product_id": cls.product.id,
36+
"product_uom": cls.product.uom_id.id,
37+
"product_uom_qty": 5.0,
38+
"qty_delivered": 4.0,
39+
},
40+
),
41+
],
42+
}
43+
)
44+
45+
def test_volume_delivered_computation(self):
46+
# Confirm the sale order to generate related sale report entries
47+
self.order.action_confirm()
48+
reference_value = f"sale.order,{self.order.id}"
49+
50+
sale_report = self.env["sale.report"].search(
51+
[("order_reference", "=", reference_value)]
52+
)
53+
self.assertTrue(
54+
sale_report,
55+
f"No sale report entries found for order_reference {reference_value}",
56+
)
57+
58+
expected_volume = sum(
59+
[
60+
line.product_id.volume
61+
* line.qty_delivered
62+
/ line.product_uom.factor
63+
* line.product_id.uom_id.factor
64+
for line in self.order.order_line
65+
if line.product_id
66+
]
67+
)
68+
69+
for report_line in sale_report:
70+
self.assertAlmostEqual(
71+
report_line.volume_delivered,
72+
expected_volume,
73+
places=2,
74+
msg=f"Volume delivered mismatch for report line {report_line.id}",
75+
)

0 commit comments

Comments
 (0)