Skip to content

Commit 22c68f7

Browse files
[MIG] stock_move_value_report: Migration to 19.0
1 parent e99c7c9 commit 22c68f7

File tree

8 files changed

+96
-74
lines changed

8 files changed

+96
-74
lines changed

stock_move_value_report/README.rst

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Stock Move Cost Value Report
2121
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2222
:alt: License: AGPL-3
2323
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github
24-
:target: https://github.com/OCA/stock-logistics-reporting/tree/18.0/stock_move_value_report
24+
:target: https://github.com/OCA/stock-logistics-reporting/tree/19.0/stock_move_value_report
2525
:alt: OCA/stock-logistics-reporting
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-18-0/stock-logistics-reporting-18-0-stock_move_value_report
27+
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-19-0/stock-logistics-reporting-19-0-stock_move_value_report
2828
:alt: Translate me on Weblate
2929
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-reporting&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-reporting&target_branch=19.0
3131
:alt: Try me on Runboat
3232

3333
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -47,24 +47,14 @@ Usage
4747
To print this report, you can go to:
4848

4949
- *Inventory > Operations > Transfers*
50-
51-
Then: #. Select records to print. #. And click on *Print > Picking
52-
Operations Cost Value*
53-
54-
Or, you can go to:
55-
5650
- *Inventory > Operations > Scrap*
57-
58-
Then: #. Select records to print. #. And click on *Print > Scrap
59-
Operations Cost Value*
60-
61-
Or, you can either go to:
62-
63-
- *Inventory > Reporting > Stock Moves*, or
51+
- *Inventory > Reporting > Stock Moves*
6452
- *Inventory > Reporting > Moves History*
6553

66-
Then: #. Select records to print. #. And click on *Print > Operations
67-
Cost Value Report*
54+
Then:
55+
56+
1. Select records to print.
57+
2. And click on *Print > Operations Cost Value Report*
6858

6959
A pdf report with operations linked to these records, and their cost,
7060
will be obtained. Keep in mind: only "done" operations will show cost
@@ -76,7 +66,7 @@ Bug Tracker
7666
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-reporting/issues>`_.
7767
In case of trouble, please check there if your issue has already been reported.
7868
If you spotted it first, help us to smash it by providing a detailed and welcomed
79-
`feedback <https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_move_value_report%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
69+
`feedback <https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_move_value_report%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
8070

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

@@ -113,6 +103,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
113103
mission is to support the collaborative development of Odoo features and
114104
promote its widespread use.
115105

116-
This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/18.0/stock_move_value_report>`_ project on GitHub.
106+
This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/19.0/stock_move_value_report>`_ project on GitHub.
117107

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

stock_move_value_report/__manifest__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33
{
44
"name": "Stock Move Cost Value Report",
5-
"version": "18.0.1.0.0",
5+
"version": "19.0.1.0.0",
66
"category": "Warehouse",
77
"website": "https://github.com/OCA/stock-logistics-reporting",
88
"author": "Tecnativa, Odoo Community Association (OCA)",
99
"license": "AGPL-3",
10-
"application": False,
1110
"installable": True,
1211
"depends": ["stock_account"],
1312
"data": [

stock_move_value_report/readme/USAGE.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
11
To print this report, you can go to:
22

3-
- *Inventory \> Operations \> Transfers*
4-
5-
Then: \#. Select records to print. \#. And click on *Print \> Picking
6-
Operations Cost Value*
7-
8-
Or, you can go to:
9-
10-
- *Inventory \> Operations \> Scrap*
11-
12-
Then: \#. Select records to print. \#. And click on *Print \> Scrap
13-
Operations Cost Value*
14-
15-
Or, you can either go to:
16-
17-
- *Inventory \> Reporting \> Stock Moves*, or
18-
- *Inventory \> Reporting \> Moves History*
19-
20-
Then: \#. Select records to print. \#. And click on *Print \> Operations
21-
Cost Value Report*
3+
- *Inventory > Operations > Transfers*
4+
- *Inventory > Operations > Scrap*
5+
- *Inventory > Reporting > Stock Moves*
6+
- *Inventory > Reporting > Moves History*
7+
8+
Then:
9+
1. Select records to print.
10+
2. And click on *Print > Operations Cost Value Report*
2211

2312
A pdf report with operations linked to these records, and their cost,
2413
will be obtained. Keep in mind: only "done" operations will show cost

stock_move_value_report/report/stock_move_line_value_report.xml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,10 @@
5858
<span t-field="move_line.product_uom_id" />
5959
</td>
6060
<td class="text-end">
61-
<t
62-
t-set="valuation_layers"
63-
t-value="move_line.move_id.stock_valuation_layer_ids"
64-
/>
61+
<t t-set="move" t-value="move_line.move_id" />
6562
<t
6663
t-set="cost"
67-
t-value="sum(valuation_layers.mapped(lambda svl: svl.unit_cost if svl.quantity > 0 else -svl.unit_cost))"
64+
t-value="sum(move.mapped(lambda m: m.value if m.quantity > 0 else -m.value))"
6865
/>
6966
<span
7067
t-esc="cost"
@@ -97,13 +94,10 @@
9794
<td class="text-end">
9895
<t t-set="total" t-value="0" />
9996
<t t-foreach="move_lines" t-as="move_line">
100-
<t
101-
t-set="valuation_layers"
102-
t-value="move_line.move_id.stock_valuation_layer_ids"
103-
/>
97+
<t t-set="move" t-value="move_line.move_id" />
10498
<t
10599
t-set="cost"
106-
t-value="sum(valuation_layers.mapped(lambda svl: svl.unit_cost if svl.quantity > 0 else -svl.unit_cost))"
100+
t-value="sum(move.mapped(lambda m: m.value if m.quantity > 0 else -m.value))"
107101
/>
108102
<t
109103
t-set="total"
@@ -134,7 +128,7 @@
134128
<t t-set="ml_from_inventories" />
135129
<t
136130
t-set="ml_from_scraps"
137-
t-value="move_lines_ids.filtered('move_id.scrapped')"
131+
t-value="move_lines_ids.filtered('move_id.scrap_id')"
138132
/>
139133
<!-- ML From Pickings -->
140134
<t t-if="ml_from_pickings">
@@ -147,11 +141,11 @@
147141
t-set="picking_move_lines"
148142
t-value="ml_from_pickings.filtered(lambda x: x.picking_id == picking)"
149143
/>
150-
<h4><span>[<t t-esc="picking.date" />]</span> Picking <t
151-
t-esc="picking.name"
152-
/>: <t t-esc="picking.location_id.name" /> &#8594; <t
153-
t-esc="picking.location_dest_id.name"
154-
/></h4>
144+
<h4><span>[<t
145+
t-esc="picking.date_done"
146+
/>]</span> Picking <t t-esc="picking.name" />: <t
147+
t-esc="picking.location_id.name"
148+
/> &#8594; <t t-esc="picking.location_dest_id.name" /></h4>
155149
<t t-call="stock_move_value_report.stock_move_lines_value">
156150
<t t-set="move_lines" t-value="picking_move_lines" />
157151
<t

stock_move_value_report/report/stock_picking_value_report.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<span t-field="picking.state" />
9292
</td>
9393
<td class="text-center">
94-
<span t-field="picking.date" />
94+
<span t-field="picking.date_done" />
9595
</td>
9696
<td class="text-center" name="td_sched_date">
9797
<span t-field="picking.scheduled_date" />

stock_move_value_report/static/description/index.html

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h1>Stock Move Cost Value Report</h1>
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375375
!! source digest: sha256:d2382457491b69b7c9be61167fc6f2023f78d6b0456aacdafb2b5597b923fcea
376376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-reporting/tree/18.0/stock_move_value_report"><img alt="OCA/stock-logistics-reporting" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-reporting-18-0/stock-logistics-reporting-18-0-stock_move_value_report"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-reporting&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-reporting/tree/19.0/stock_move_value_report"><img alt="OCA/stock-logistics-reporting" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-reporting-19-0/stock-logistics-reporting-19-0-stock_move_value_report"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-reporting&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378378
<p>This module allows to obtain a report with cost value of a given
379379
operation like a picking, a scrap, an inventory or even a selection of
380380
moves or move lines.</p>
@@ -396,22 +396,15 @@ <h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
396396
<p>To print this report, you can go to:</p>
397397
<ul class="simple">
398398
<li><em>Inventory &gt; Operations &gt; Transfers</em></li>
399-
</ul>
400-
<p>Then: #. Select records to print. #. And click on <em>Print &gt; Picking
401-
Operations Cost Value</em></p>
402-
<p>Or, you can go to:</p>
403-
<ul class="simple">
404399
<li><em>Inventory &gt; Operations &gt; Scrap</em></li>
405-
</ul>
406-
<p>Then: #. Select records to print. #. And click on <em>Print &gt; Scrap
407-
Operations Cost Value</em></p>
408-
<p>Or, you can either go to:</p>
409-
<ul class="simple">
410-
<li><em>Inventory &gt; Reporting &gt; Stock Moves</em>, or</li>
400+
<li><em>Inventory &gt; Reporting &gt; Stock Moves</em></li>
411401
<li><em>Inventory &gt; Reporting &gt; Moves History</em></li>
412402
</ul>
413-
<p>Then: #. Select records to print. #. And click on <em>Print &gt; Operations
414-
Cost Value Report</em></p>
403+
<p>Then:</p>
404+
<ol class="arabic simple">
405+
<li>Select records to print.</li>
406+
<li>And click on <em>Print &gt; Operations Cost Value Report</em></li>
407+
</ol>
415408
<p>A pdf report with operations linked to these records, and their cost,
416409
will be obtained. Keep in mind: only “done” operations will show cost
417410
value.</p>
@@ -421,7 +414,7 @@ <h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
421414
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/issues">GitHub Issues</a>.
422415
In case of trouble, please check there if your issue has already been reported.
423416
If you spotted it first, help us to smash it by providing a detailed and welcomed
424-
<a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_move_value_report%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
417+
<a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_move_value_report%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
425418
<p>Do not contact contributors directly about support or help with technical issues.</p>
426419
</div>
427420
<div class="section" id="credits">
@@ -455,7 +448,7 @@ <h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
455448
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
456449
mission is to support the collaborative development of Odoo features and
457450
promote its widespread use.</p>
458-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/tree/18.0/stock_move_value_report">OCA/stock-logistics-reporting</a> project on GitHub.</p>
451+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/tree/19.0/stock_move_value_report">OCA/stock-logistics-reporting</a> project on GitHub.</p>
459452
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
460453
</div>
461454
</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import test_stock_move_value_report
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright 2025 ACSONE SA/NV (<http://acsone.eu>)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
5+
from odoo.addons.stock_account.tests.common import TestStockValuationCommon
6+
7+
8+
class Test(TestStockValuationCommon):
9+
"""
10+
Tests for stock_move_value_report.
11+
"""
12+
13+
@classmethod
14+
def setUpClass(cls):
15+
super().setUpClass()
16+
cls.move = cls._make_in_move(
17+
cls.product_standard, 10, unit_cost=15, create_picking=True
18+
)
19+
cls.move_lines = cls.move.move_line_ids
20+
cls.picking = cls.move.picking_id
21+
cls.scrap = cls.env["stock.scrap"].create(
22+
{
23+
"product_id": cls.product_standard.id,
24+
"product_uom_id": cls.product_standard.uom_id.id,
25+
}
26+
)
27+
28+
def _render_report(self, report_name, records):
29+
"""
30+
Ensure rendering passes without errors
31+
"""
32+
context = {
33+
**self.env.context,
34+
"active_ids": records.ids,
35+
"active_model": "stock.move",
36+
}
37+
self.env["ir.actions.report"].with_context(**context)._render_qweb_pdf(
38+
report_name, records.ids, data={"context": context}
39+
)
40+
41+
def test_report_stock_move_line_value(self):
42+
report_name = "stock_move_value_report.report_stock_move_line_value"
43+
self._render_report(report_name, self.move_lines)
44+
45+
def test_report_stock_move_value(self):
46+
report_name = "stock_move_value_report.report_stock_move_value"
47+
self._render_report(report_name, self.move)
48+
49+
def test_report_stock_picking_value(self):
50+
report_name = "stock_move_value_report.report_stock_picking_value"
51+
self._render_report(report_name, self.picking)
52+
53+
def test_report_stock_scrap_value(self):
54+
report_name = "stock_move_value_report.report_stock_scrap_value"
55+
self.assertTrue(bool(self.scrap))
56+
self._render_report(report_name, self.scrap)

0 commit comments

Comments
 (0)