Skip to content

Commit bd1fb00

Browse files
committed
[19.0][MIG] stock_picking_line_sequence: Migration to 19.0
1 parent 962c8ab commit bd1fb00

File tree

7 files changed

+108
-52
lines changed

7 files changed

+108
-52
lines changed

stock_picking_line_sequence/README.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Stock picking lines with sequence number
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--workflow-lightgray.png?logo=github
24-
:target: https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_picking_line_sequence
24+
:target: https://github.com/OCA/stock-logistics-workflow/tree/19.0/stock_picking_line_sequence
2525
:alt: OCA/stock-logistics-workflow
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-18-0/stock-logistics-workflow-18-0-stock_picking_line_sequence
27+
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-19-0/stock-logistics-workflow-19-0-stock_picking_line_sequence
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-workflow&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=19.0
3131
:alt: Try me on Runboat
3232

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

6060
Do not contact contributors directly about support or help with technical issues.
6161

@@ -80,6 +80,7 @@ Contributors
8080
- Serpent Consulting Services Pvt. Ltd. <[email protected]>
8181
- Sulivan Lominchar <[email protected]>
8282
- Stefan Rijnhart <[email protected]>
83+
- Hudson Amadeus Leonardy <https://solusiaglis.co.id>
8384

8485
Maintainers
8586
-----------
@@ -94,6 +95,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
9495
mission is to support the collaborative development of Odoo features and
9596
promote its widespread use.
9697

97-
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_picking_line_sequence>`_ project on GitHub.
98+
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/19.0/stock_picking_line_sequence>`_ project on GitHub.
9899

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

stock_picking_line_sequence/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
"name": "Stock picking lines with sequence number",
88
"summary": "Manages the order of stock moves by displaying its sequence",
9-
"version": "18.0.1.0.1",
9+
"version": "19.0.1.0.1",
1010
"category": "Warehouse Management",
1111
"author": "Camptocamp, "
1212
"ForgeFlow, "

stock_picking_line_sequence/models/stock_picking.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class StockPicking(models.Model):
1111
_inherit = "stock.picking"
1212

13-
@api.depends("move_ids_without_package")
13+
@api.depends("move_ids")
1414
def _compute_max_line_sequence(self):
1515
"""Allow to know the highest sequence entered in move lines.
1616
Then we add 1 to this value for the next sequence, this value is
@@ -20,7 +20,7 @@ def _compute_max_line_sequence(self):
2020
"""
2121
for picking in self:
2222
picking.max_line_sequence = (
23-
max(picking.mapped("move_ids_without_package.sequence") or [0]) + 1
23+
max(picking.mapped("move_ids.sequence") or [0]) + 1
2424
)
2525

2626
max_line_sequence = fields.Integer(
@@ -30,7 +30,7 @@ def _compute_max_line_sequence(self):
3030
def _reset_sequence(self):
3131
for rec in self:
3232
current_sequence = 1
33-
for line in rec.move_ids_without_package:
33+
for line in rec.move_ids:
3434
# Check if the record ID is an integer (real ID)
3535
# not NewId
3636
if isinstance(line.id, int):
@@ -51,15 +51,15 @@ def button_validate(self):
5151
def get_view(self, view_id=None, view_type="form", **options):
5252
"""Append the default sequence.
5353
54-
The context of `move_ids_without_package` is already overloaded
54+
The context of `move_ids` is already overloaded
5555
and replacing it in a view does not scale across other extension
5656
modules.
5757
"""
5858
res = super().get_view(view_id=view_id, view_type=view_type, **options)
5959

6060
if res.get("arch") and view_type == "form":
6161
doc = etree.XML(res["arch"])
62-
elements = doc.xpath("//field[@name='move_ids_without_package']")
62+
elements = doc.xpath("//field[@name='move_ids']")
6363
if elements:
6464
element = elements[0]
6565
context = element.get("context", "{}")

stock_picking_line_sequence/readme/CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
- Serpent Consulting Services Pvt. Ltd. \<<[email protected]>\>
66
- Sulivan Lominchar \<<[email protected]>\>
77
- Stefan Rijnhart \<<[email protected]>\>
8+
- Hudson Amadeus Leonardy \<<https://solusiaglis.co.id>\>

stock_picking_line_sequence/static/description/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h1>Stock picking lines with sequence number</h1>
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375375
!! source digest: sha256:a184f3e732b88c75b2606bbd9c77f8777540d522aae97c00ae56429f0d18dfa6
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-workflow/tree/18.0/stock_picking_line_sequence"><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_picking_line_sequence"><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/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-workflow/tree/19.0/stock_picking_line_sequence"><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_picking_line_sequence"><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>
378378
<p>Provide a new field sequence on stock moves, which allows to manage the
379379
order of moves in a picking.</p>
380380
<p>For further information, please visit:</p>
@@ -402,7 +402,7 @@ <h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
402402
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues">GitHub Issues</a>.
403403
In case of trouble, please check there if your issue has already been reported.
404404
If you spotted it first, help us to smash it by providing a detailed and welcomed
405-
<a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_line_sequence%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
405+
<a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_line_sequence%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
406406
<p>Do not contact contributors directly about support or help with technical issues.</p>
407407
</div>
408408
<div class="section" id="credits">
@@ -426,6 +426,7 @@ <h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
426426
<li>Serpent Consulting Services Pvt. Ltd. &lt;<a class="reference external" href="mailto:support&#64;serpentcs.com">support&#64;serpentcs.com</a>&gt;</li>
427427
<li>Sulivan Lominchar &lt;<a class="reference external" href="mailto:slominchar&#64;archeti.com">slominchar&#64;archeti.com</a>&gt;</li>
428428
<li>Stefan Rijnhart &lt;<a class="reference external" href="mailto:stefan&#64;opener.amsterdam">stefan&#64;opener.amsterdam</a>&gt;</li>
429+
<li>Hudson Amadeus Leonardy &lt;<a class="reference external" href="https://solusiaglis.co.id">https://solusiaglis.co.id</a>&gt;</li>
429430
</ul>
430431
</div>
431432
<div class="section" id="maintainers">
@@ -437,7 +438,7 @@ <h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
437438
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
438439
mission is to support the collaborative development of Odoo features and
439440
promote its widespread use.</p>
440-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_picking_line_sequence">OCA/stock-logistics-workflow</a> project on GitHub.</p>
441+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/19.0/stock_picking_line_sequence">OCA/stock-logistics-workflow</a> project on GitHub.</p>
441442
<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>
442443
</div>
443444
</div>

stock_picking_line_sequence/tests/test_move_lines_sequence.py

Lines changed: 89 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,115 @@
77

88

99
class TestStockMove(common.TransactionCase):
10-
def setUp(self):
11-
super().setUp()
10+
@classmethod
11+
def setUpClass(cls):
12+
super().setUpClass()
1213
# Useful models
13-
self.Picking = self.env["stock.picking"]
14-
self.product_id_1 = self.env.ref("product.product_product_8")
15-
self.product_id_2 = self.env.ref("product.product_product_11")
16-
self.product_id_3 = self.env.ref("product.product_product_6")
17-
self.picking_type_in = self.env.ref("stock.warehouse0").in_type_id
18-
self.supplier_location = self.env.ref("stock.stock_location_suppliers")
19-
self.customer_location = self.env.ref("stock.stock_location_customers")
14+
cls.Picking = cls.env["stock.picking"]
15+
# cls.product_id_1 = cls.env.ref("product.product_product_8")
16+
cls.category_office = cls.env["product.category"].create(
17+
{
18+
"name": "Office Furniture",
19+
}
20+
)
21+
22+
# Buat satuan (UoM)
23+
cls.uom_unit = cls.env.ref("uom.product_uom_unit")
24+
25+
# Buat product Large Desk (mengganti XML <record> demo)
26+
cls.product_large_desk = cls.env["product.product"].create(
27+
{
28+
"name": "Large Desk",
29+
"categ_id": cls.category_office.id,
30+
"standard_price": 1299.0,
31+
"list_price": 1799.0,
32+
"type": "consu",
33+
"uom_id": cls.uom_unit.id,
34+
"default_code": "E-COM09",
35+
}
36+
)
37+
38+
# cls.product_id_2 = cls.env.ref("product.product_product_11")
39+
cls.product_conference_chair = cls.env["product.product"].create(
40+
{
41+
"name": "Conference Chair",
42+
"categ_id": cls.category_office.id,
43+
"standard_price": 28.0,
44+
"list_price": 33.0,
45+
"type": "consu",
46+
"uom_id": cls.uom_unit.id,
47+
"default_code": "E-COM12",
48+
}
49+
)
50+
51+
# cls.product_id_3 = cls.env.ref("product.product_product_6")
52+
cls.product_large_cabinet = cls.env["product.product"].create(
53+
{
54+
"name": "Large Cabinet",
55+
"categ_id": cls.category_office.id,
56+
"standard_price": 800.0,
57+
"list_price": 320.0,
58+
"type": "consu",
59+
"uom_id": cls.uom_unit.id,
60+
"default_code": "E-COM07",
61+
}
62+
)
63+
64+
cls.main_partner = cls.env.ref("base.main_partner")
65+
66+
cls.warehouse0 = cls.env["stock.warehouse"].create(
67+
{
68+
"name": "Test Warehouse",
69+
"code": "TWH",
70+
"partner_id": cls.main_partner.id,
71+
"company_id": cls.env.company.id,
72+
}
73+
)
74+
75+
cls.picking_type_in = cls.warehouse0.in_type_id
76+
77+
cls.supplier_location = cls.env.ref("stock.stock_location_suppliers")
78+
cls.customer_location = cls.env.ref("stock.stock_location_customers")
2079

21-
def _create_picking(self):
80+
def _create_picking(cls):
2281
"""Create a Picking."""
23-
picking = self.Picking.create(
82+
picking = cls.Picking.create(
2483
{
25-
"picking_type_id": self.picking_type_in.id,
26-
"location_id": self.supplier_location.id,
27-
"location_dest_id": self.customer_location.id,
84+
"picking_type_id": cls.picking_type_in.id,
85+
"location_id": cls.supplier_location.id,
86+
"location_dest_id": cls.customer_location.id,
2887
"move_ids": [
2988
(
3089
0,
3190
0,
3291
{
33-
"name": "move 1",
34-
"product_id": self.product_id_1.id,
92+
"product_id": cls.product_large_desk.id,
3593
"product_uom_qty": 5.0,
36-
"product_uom": self.product_id_1.uom_id.id,
37-
"location_id": self.supplier_location.id,
38-
"location_dest_id": self.customer_location.id,
94+
"product_uom": cls.product_large_desk.uom_id.id,
95+
"location_id": cls.supplier_location.id,
96+
"location_dest_id": cls.customer_location.id,
3997
},
4098
),
4199
(
42100
0,
43101
0,
44102
{
45-
"name": "move 2",
46-
"product_id": self.product_id_2.id,
103+
"product_id": cls.product_conference_chair.id,
47104
"product_uom_qty": 5.0,
48-
"product_uom": self.product_id_2.uom_id.id,
49-
"location_id": self.supplier_location.id,
50-
"location_dest_id": self.customer_location.id,
105+
"product_uom": cls.product_conference_chair.uom_id.id,
106+
"location_id": cls.supplier_location.id,
107+
"location_dest_id": cls.customer_location.id,
51108
},
52109
),
53110
(
54111
0,
55112
0,
56113
{
57-
"name": "move 3",
58-
"product_id": self.product_id_3.id,
114+
"product_id": cls.product_large_cabinet.id,
59115
"product_uom_qty": 5.0,
60-
"product_uom": self.product_id_3.uom_id.id,
61-
"location_id": self.supplier_location.id,
62-
"location_dest_id": self.customer_location.id,
116+
"product_uom": cls.product_large_cabinet.uom_id.id,
117+
"location_id": cls.supplier_location.id,
118+
"location_dest_id": cls.customer_location.id,
63119
},
64120
),
65121
],
@@ -73,23 +129,23 @@ def test_move_lines_sequence(self):
73129
self.picking.move_ids.write({"product_uom_qty": 10.0})
74130
self.picking2 = self.picking.copy()
75131
self.assertEqual(
76-
self.picking2[0].move_ids[0].sequence,
132+
self.picking2.move_ids[0].sequence,
77133
self.picking.move_ids[0].sequence,
78134
"The Sequence is not copied properly",
79135
)
80136
self.assertEqual(
81-
self.picking2[0].move_ids[1].sequence,
137+
self.picking2.move_ids[1].sequence,
82138
self.picking.move_ids[1].sequence,
83139
"The Sequence is not copied properly",
84140
)
85141
self.assertEqual(
86-
self.picking2[0].move_ids[2].sequence,
142+
self.picking2.move_ids[2].sequence,
87143
self.picking.move_ids[2].sequence,
88144
"The Sequence is not copied properly",
89145
)
90146
picking_form = Form(self.picking)
91147
with picking_form.move_ids_without_package.new() as move_form:
92-
move_form.product_id = self.product_id_1
148+
move_form.product_id = self.product_large_desk
93149
self.assertEqual(move_form.sequence, self.picking.max_line_sequence)
94150

95151
def test_backorder(self):

stock_picking_line_sequence/views/stock_picking_views.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66
<field name="inherit_id" ref="stock.view_picking_form" />
77
<field name="priority" eval="255" />
88
<field name="arch" type="xml">
9-
<xpath
10-
expr="//notebook/page/field[@name='move_ids_without_package']"
11-
position="before"
12-
>
9+
<xpath expr="//notebook/page/field[@name='move_ids']" position="before">
1310
<field name="max_line_sequence" invisible="1" />
1411
</xpath>
1512
<xpath
16-
expr="//notebook/page/field[@name='move_ids_without_package']/list/field[@name='name']"
13+
expr="//notebook/page/field[@name='move_ids']/list/field[@name='state']"
1714
position="before"
1815
>
1916
<field name="sequence" widget="handle" />

0 commit comments

Comments
 (0)