Skip to content

Commit 0127d55

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

File tree

5 files changed

+45
-48
lines changed

5 files changed

+45
-48
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: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def _create_move_with_lot(self):
4343
"location_dest_id": self.output_loc.id,
4444
"product_uom_qty": 1,
4545
"product_uom": self.product.uom_id.id,
46-
"name": "test",
4746
"procure_method": "make_to_order",
4847
"warehouse_id": self.warehouse.id,
4948
"route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
@@ -70,7 +69,6 @@ def _create_move_dest(self):
7069
"product_uom": self.product.uom_id.id,
7170
"picking_type_id": self.warehouse.out_type_id.id,
7271
"location_dest_id": self.output_loc.id,
73-
"name": "test",
7472
"procure_method": "make_to_order",
7573
"warehouse_id": self.warehouse.id,
7674
"route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
@@ -87,7 +85,6 @@ def test_00_move_restrict_lot_propagation(self):
8785
"location_dest_id": self.output_loc.id,
8886
"product_uom_qty": 1,
8987
"product_uom": self.product.uom_id.id,
90-
"name": "test",
9188
"procure_method": "make_to_order",
9289
"warehouse_id": self.warehouse.id,
9390
"route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
@@ -106,7 +103,6 @@ def test_01_move_split_and_copy(self):
106103
"location_dest_id": self.output_loc.id,
107104
"product_uom_qty": 2,
108105
"product_uom": self.product.uom_id.id,
109-
"name": "test",
110106
"procure_method": "make_to_stock",
111107
"warehouse_id": self.warehouse.id,
112108
"route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
@@ -150,7 +146,6 @@ def test_02_move_restrict_lot_reservation(self):
150146
"location_dest_id": self.customer_loc.id,
151147
"product_uom_qty": 1,
152148
"product_uom": self.product.uom_id.id,
153-
"name": "test",
154149
"warehouse_id": self.warehouse.id,
155150
"restrict_lot_id": self.lot.id,
156151
}
@@ -196,12 +191,10 @@ def test_procurement_with_2_steps_output(self):
196191
self._update_product_stock(25, lot2.id, location=location_2)
197192

198193
# 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(
194+
reference = self.env["stock.reference"].create({"name": "My procurement"})
195+
self.env["stock.rule"].run(
203196
[
204-
self.env["procurement.group"].Procurement(
197+
self.env["stock.rule"].Procurement(
205198
self.product,
206199
15,
207200
self.product.uom_id,
@@ -210,11 +203,11 @@ def test_procurement_with_2_steps_output(self):
210203
"an origin restrict on lot 1",
211204
self.env.company,
212205
{
213-
"group_id": procurement_group,
206+
"reference_ids": reference,
214207
"restrict_lot_id": self.lot.id,
215208
},
216209
),
217-
self.env["procurement.group"].Procurement(
210+
self.env["stock.rule"].Procurement(
218211
self.product,
219212
30,
220213
self.product.uom_id,
@@ -223,7 +216,7 @@ def test_procurement_with_2_steps_output(self):
223216
"an origin restrict on lot 2",
224217
self.env.company,
225218
{
226-
"group_id": procurement_group,
219+
"reference_ids": reference,
227220
"restrict_lot_id": lot2.id,
228221
},
229222
),
@@ -249,34 +242,30 @@ def assert_move_line_per_lot_and_location(
249242
concern_move_line.quantity_product_uom, expect_reserved_qty
250243
)
251244

252-
pick = procurement_group.stock_move_ids.picking_id
245+
pick = reference.move_ids.picking_id
253246
self.assertEqual(len(pick), 1)
254247
self.assertEqual(pick.picking_type_id.code, "internal")
255248
self.assertEqual(pick.state, "assigned")
256249
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-
)
250+
assert_move_qty_per_lot(pick.move_ids, self.lot, 15)
251+
assert_move_qty_per_lot(pick.move_ids, lot2, 30)
265252
assert_move_line_per_lot_and_location(
266-
pick.move_line_ids_without_package, lot2, location_1, 5
253+
pick.move_line_ids, self.lot, location_1, 10
267254
)
268255
assert_move_line_per_lot_and_location(
269-
pick.move_line_ids_without_package, lot2, location_2, 25
256+
pick.move_line_ids, self.lot, location_2, 5
270257
)
258+
assert_move_line_per_lot_and_location(pick.move_line_ids, lot2, location_1, 5)
259+
assert_move_line_per_lot_and_location(pick.move_line_ids, lot2, location_2, 25)
271260
pick.button_validate()
272261
self.assertEqual(pick.state, "done")
273262

274-
delivery = procurement_group.stock_move_ids.picking_id - pick
263+
delivery = reference.move_ids.picking_id - pick
275264
self.assertEqual(delivery.picking_type_id.code, "outgoing")
276265
self.assertEqual(delivery.state, "assigned")
277266

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)
267+
assert_move_qty_per_lot(delivery.move_ids, self.lot, 15)
268+
assert_move_qty_per_lot(delivery.move_ids, lot2, 30)
280269

281270
def test_compute_quantites(self):
282271
move = self.env["stock.move"].create(
@@ -286,7 +275,6 @@ def test_compute_quantites(self):
286275
"location_dest_id": self.customer_loc.id,
287276
"product_uom_qty": 1,
288277
"product_uom": self.product.uom_id.id,
289-
"name": "test",
290278
"procure_method": "make_to_stock",
291279
"warehouse_id": self.warehouse.id,
292280
"route_ids": [(6, 0, self.warehouse.delivery_route_id.ids)],
@@ -333,7 +321,6 @@ def test_move_validation_inconsistent_lot(self):
333321
"location_dest_id": self.customer_loc.id,
334322
"product_uom_qty": 1,
335323
"product_uom": self.product.uom_id.id,
336-
"name": "test",
337324
"warehouse_id": self.warehouse.id,
338325
"restrict_lot_id": self.lot.id,
339326
}

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)