Skip to content

Commit 06ac439

Browse files
committed
[MIG] stock_restrict_lot: Migration to 19.0
1 parent 49160f7 commit 06ac439

File tree

5 files changed

+55
-52
lines changed

5 files changed

+55
-52
lines changed

stock_restrict_lot/README.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
15
==================
26
Stock Restrict Lot
37
==================
@@ -13,17 +17,17 @@ Stock Restrict Lot
1317
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1418
:target: https://odoo-community.org/page/development-status
1519
:alt: Beta
16-
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
20+
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
1721
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1822
:alt: License: LGPL-3
1923
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
20-
:target: https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_restrict_lot
24+
:target: https://github.com/OCA/stock-logistics-workflow/tree/19.0/stock_restrict_lot
2125
:alt: OCA/stock-logistics-workflow
2226
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-18-0/stock-logistics-workflow-18-0-stock_restrict_lot
27+
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-19-0/stock-logistics-workflow-19-0-stock_restrict_lot
2428
:alt: Translate me on Weblate
2529
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=19.0
2731
:alt: Try me on Runboat
2832

2933
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -45,7 +49,7 @@ Bug Tracker
4549
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
4650
In case of trouble, please check there if your issue has already been reported.
4751
If you spotted it first, help us to smash it by providing a detailed and welcomed
48-
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_restrict_lot%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
52+
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_restrict_lot%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
4953

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

@@ -85,6 +89,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
8589

8690
|maintainer-florian-dacosta|
8791

88-
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_restrict_lot>`_ project on GitHub.
92+
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/19.0/stock_restrict_lot>`_ project on GitHub.
8993

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

stock_restrict_lot/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Stock Restrict Lot",
55
"summary": "Base module that add back the concept of restrict lot on stock move",
6-
"version": "18.0.1.0.0",
6+
"version": "19.0.1.0.0",
77
"category": "Warehouse Management",
88
"website": "https://github.com/OCA/stock-logistics-workflow",
99
"author": "Akretion, Odoo Community Association (OCA)",

stock_restrict_lot/static/description/index.html

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>Stock Restrict Lot</title>
6+
<title>README.rst</title>
77
<style type="text/css">
88

99
/*
@@ -360,16 +360,21 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document" id="stock-restrict-lot">
364-
<h1 class="title">Stock Restrict Lot</h1>
363+
<div class="document">
365364

365+
366+
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367+
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368+
</a>
369+
<div class="section" id="stock-restrict-lot">
370+
<h1>Stock Restrict Lot</h1>
366371
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367372
!! This file is generated by oca-gen-addon-readme !!
368373
!! changes will be overwritten. !!
369374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370375
!! source digest: sha256:dce023da3482003599a49ae27980bca635a30f0b86afd9ee1bcbeb8d3ae775d9
371376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_restrict_lot"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-18-0/stock-logistics-workflow-18-0-stock_restrict_lot"><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-workflow&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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-workflow/tree/19.0/stock_restrict_lot"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-19-0/stock-logistics-workflow-19-0-stock_restrict_lot"><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-workflow&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373378
<p>This module adds a field to restrict a stock move to a specific lot. It
374379
propagates it between chained moves. A move with a restrict lot will
375380
only be able to reserve or transfer products with the specified lot.
@@ -388,31 +393,31 @@ <h1 class="title">Stock Restrict Lot</h1>
388393
</ul>
389394
</div>
390395
<div class="section" id="bug-tracker">
391-
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
396+
<h2><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h2>
392397
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues">GitHub Issues</a>.
393398
In case of trouble, please check there if your issue has already been reported.
394399
If you spotted it first, help us to smash it by providing a detailed and welcomed
395-
<a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_restrict_lot%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
400+
<a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_restrict_lot%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
396401
<p>Do not contact contributors directly about support or help with technical issues.</p>
397402
</div>
398403
<div class="section" id="credits">
399-
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
404+
<h2><a class="toc-backref" href="#toc-entry-2">Credits</a></h2>
400405
<div class="section" id="authors">
401-
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
406+
<h3><a class="toc-backref" href="#toc-entry-3">Authors</a></h3>
402407
<ul class="simple">
403408
<li>Akretion</li>
404409
</ul>
405410
</div>
406411
<div class="section" id="contributors">
407-
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
412+
<h3><a class="toc-backref" href="#toc-entry-4">Contributors</a></h3>
408413
<ul class="simple">
409414
<li>Florian da Costa &lt;<a class="reference external" href="mailto:florian.dacosta&#64;akretion.com">florian.dacosta&#64;akretion.com</a>&gt;</li>
410415
<li>Ruchir Shukla &lt;<a class="reference external" href="mailto:ruchir&#64;bizzappdev.com">ruchir&#64;bizzappdev.com</a>&gt;</li>
411416
<li>Stefan Rijnhart &lt;<a class="reference external" href="mailto:stefan&#64;opener.amsterdam">stefan&#64;opener.amsterdam</a>&gt;</li>
412417
</ul>
413418
</div>
414419
<div class="section" id="maintainers">
415-
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
420+
<h3><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h3>
416421
<p>This module is maintained by the OCA.</p>
417422
<a class="reference external image-reference" href="https://odoo-community.org">
418423
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -422,10 +427,11 @@ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
422427
promote its widespread use.</p>
423428
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
424429
<p><a class="reference external image-reference" href="https://github.com/florian-dacosta"><img alt="florian-dacosta" src="https://github.com/florian-dacosta.png?size=40px" /></a></p>
425-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_restrict_lot">OCA/stock-logistics-workflow</a> project on GitHub.</p>
430+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/19.0/stock_restrict_lot">OCA/stock-logistics-workflow</a> project on GitHub.</p>
426431
<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>
427432
</div>
428433
</div>
429434
</div>
435+
</div>
430436
</body>
431437
</html>

stock_restrict_lot/tests/test_restrict_lot.py

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ def setUpClass(cls):
1010
super().setUpClass()
1111
cls.customer_loc = cls.env.ref("stock.stock_location_customers")
1212
cls.output_loc = cls.env.ref("stock.stock_location_output")
13-
cls.product = cls.env.ref("product.product_product_16").copy()
14-
cls.product.write({"tracking": "lot"})
1513
cls.warehouse = cls.env.ref("stock.warehouse0")
14+
cls.product = cls.env["product.product"].create(
15+
{
16+
"name": "Test Product",
17+
"type": "consu",
18+
"is_storable": True,
19+
"tracking": "lot",
20+
}
21+
)
1622
cls.warehouse.write({"delivery_steps": "pick_ship"})
1723
cls.stock_loc = cls.warehouse.lot_stock_id
1824

@@ -43,7 +49,6 @@ def _create_move_with_lot(self):
4349
"location_dest_id": self.output_loc.id,
4450
"product_uom_qty": 1,
4551
"product_uom": self.product.uom_id.id,
46-
"name": "test",
4752
"procure_method": "make_to_order",
4853
"warehouse_id": self.warehouse.id,
4954
"route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
@@ -70,7 +75,6 @@ def _create_move_dest(self):
7075
"product_uom": self.product.uom_id.id,
7176
"picking_type_id": self.warehouse.out_type_id.id,
7277
"location_dest_id": self.output_loc.id,
73-
"name": "test",
7478
"procure_method": "make_to_order",
7579
"warehouse_id": self.warehouse.id,
7680
"route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
@@ -87,7 +91,6 @@ def test_00_move_restrict_lot_propagation(self):
8791
"location_dest_id": self.output_loc.id,
8892
"product_uom_qty": 1,
8993
"product_uom": self.product.uom_id.id,
90-
"name": "test",
9194
"procure_method": "make_to_order",
9295
"warehouse_id": self.warehouse.id,
9396
"route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
@@ -106,7 +109,6 @@ def test_01_move_split_and_copy(self):
106109
"location_dest_id": self.output_loc.id,
107110
"product_uom_qty": 2,
108111
"product_uom": self.product.uom_id.id,
109-
"name": "test",
110112
"procure_method": "make_to_stock",
111113
"warehouse_id": self.warehouse.id,
112114
"route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
@@ -150,7 +152,6 @@ def test_02_move_restrict_lot_reservation(self):
150152
"location_dest_id": self.customer_loc.id,
151153
"product_uom_qty": 1,
152154
"product_uom": self.product.uom_id.id,
153-
"name": "test",
154155
"warehouse_id": self.warehouse.id,
155156
"restrict_lot_id": self.lot.id,
156157
}
@@ -196,12 +197,10 @@ def test_procurement_with_2_steps_output(self):
196197
self._update_product_stock(25, lot2.id, location=location_2)
197198

198199
# create a procurement with two lines of same product with different lots
199-
procurement_group = self.env["procurement.group"].create(
200-
{"name": "My procurement", "move_type": "one"}
201-
)
202-
self.env["procurement.group"].run(
200+
reference = self.env["stock.reference"].create({"name": "My procurement"})
201+
self.env["stock.rule"].run(
203202
[
204-
self.env["procurement.group"].Procurement(
203+
self.env["stock.rule"].Procurement(
205204
self.product,
206205
15,
207206
self.product.uom_id,
@@ -210,11 +209,12 @@ def test_procurement_with_2_steps_output(self):
210209
"an origin restrict on lot 1",
211210
self.env.company,
212211
{
213-
"group_id": procurement_group,
212+
"warehouse_id": self.warehouse,
213+
"reference_ids": reference,
214214
"restrict_lot_id": self.lot.id,
215215
},
216216
),
217-
self.env["procurement.group"].Procurement(
217+
self.env["stock.rule"].Procurement(
218218
self.product,
219219
30,
220220
self.product.uom_id,
@@ -223,7 +223,8 @@ def test_procurement_with_2_steps_output(self):
223223
"an origin restrict on lot 2",
224224
self.env.company,
225225
{
226-
"group_id": procurement_group,
226+
"warehouse_id": self.warehouse,
227+
"reference_ids": reference,
227228
"restrict_lot_id": lot2.id,
228229
},
229230
),
@@ -249,34 +250,28 @@ def assert_move_line_per_lot_and_location(
249250
concern_move_line.quantity_product_uom, expect_reserved_qty
250251
)
251252

252-
pick = procurement_group.stock_move_ids.picking_id
253-
self.assertEqual(len(pick), 1)
254-
self.assertEqual(pick.picking_type_id.code, "internal")
253+
pick = reference.move_ids.picking_id[0]
255254
self.assertEqual(pick.state, "assigned")
256255
self.assertEqual(len(pick.move_ids), 2)
257-
assert_move_qty_per_lot(pick.move_ids_without_package, self.lot, 15)
258-
assert_move_qty_per_lot(pick.move_ids_without_package, lot2, 30)
259-
assert_move_line_per_lot_and_location(
260-
pick.move_line_ids_without_package, self.lot, location_1, 10
261-
)
262-
assert_move_line_per_lot_and_location(
263-
pick.move_line_ids_without_package, self.lot, location_2, 5
264-
)
256+
assert_move_qty_per_lot(pick.move_ids, self.lot, 15)
257+
assert_move_qty_per_lot(pick.move_ids, lot2, 30)
265258
assert_move_line_per_lot_and_location(
266-
pick.move_line_ids_without_package, lot2, location_1, 5
259+
pick.move_line_ids, self.lot, location_1, 10
267260
)
268261
assert_move_line_per_lot_and_location(
269-
pick.move_line_ids_without_package, lot2, location_2, 25
262+
pick.move_line_ids, self.lot, location_2, 5
270263
)
264+
assert_move_line_per_lot_and_location(pick.move_line_ids, lot2, location_1, 5)
265+
assert_move_line_per_lot_and_location(pick.move_line_ids, lot2, location_2, 25)
271266
pick.button_validate()
272267
self.assertEqual(pick.state, "done")
273268

274-
delivery = procurement_group.stock_move_ids.picking_id - pick
269+
delivery = reference.move_ids.picking_id - pick
275270
self.assertEqual(delivery.picking_type_id.code, "outgoing")
276271
self.assertEqual(delivery.state, "assigned")
277272

278-
assert_move_qty_per_lot(delivery.move_ids_without_package, self.lot, 15)
279-
assert_move_qty_per_lot(delivery.move_ids_without_package, lot2, 30)
273+
assert_move_qty_per_lot(delivery.move_ids, self.lot, 15)
274+
assert_move_qty_per_lot(delivery.move_ids, lot2, 30)
280275

281276
def test_compute_quantites(self):
282277
move = self.env["stock.move"].create(
@@ -286,7 +281,6 @@ def test_compute_quantites(self):
286281
"location_dest_id": self.customer_loc.id,
287282
"product_uom_qty": 1,
288283
"product_uom": self.product.uom_id.id,
289-
"name": "test",
290284
"procure_method": "make_to_stock",
291285
"warehouse_id": self.warehouse.id,
292286
"route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
@@ -333,7 +327,6 @@ def test_move_validation_inconsistent_lot(self):
333327
"location_dest_id": self.customer_loc.id,
334328
"product_uom_qty": 1,
335329
"product_uom": self.product.uom_id.id,
336-
"name": "test",
337330
"warehouse_id": self.warehouse.id,
338331
"restrict_lot_id": self.lot.id,
339332
}

stock_restrict_lot/views/stock_picking.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<field name="inherit_id" ref="stock.view_picking_form" />
66
<field name="arch" type="xml">
77
<xpath
8-
expr="//field[@name='move_ids_without_package']/list/field[@name='product_id']"
8+
expr="//page[@name='operations']//field[@name='product_id']"
99
position="after"
1010
>
1111
<field

0 commit comments

Comments
 (0)