Skip to content

Commit

Permalink
[MIG] stock_auto_move: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBinsfeld committed Dec 28, 2023
1 parent 3132475 commit 7ea99d4
Show file tree
Hide file tree
Showing 22 changed files with 43 additions and 48 deletions.
4 changes: 2 additions & 2 deletions stock_auto_move/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "Automatic Move Processing",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"author": "NDP Systèmes, ACSONE SA/NV, Odoo Community Association (OCA)",
"category": "Warehouse",
"development_status": "Production/Stable",
Expand All @@ -17,7 +17,7 @@
],
"demo": [
"demo/stock_location.xml",
"demo/stock_location_route.xml",
"demo/stock_route.xml",
"demo/stock_rule.xml",
],
"installable": True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Copyright 2014-2015 NDP Systèmes (<https://www.ndp-systemes.fr>)
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record model="stock.location.route" id="test_route">
<record model="stock.route" id="test_route">
<field name="name">Test route</field>
<field name="active">1</field>
<field name="sequence">20</field>
Expand Down
4 changes: 2 additions & 2 deletions stock_auto_move/demo/stock_rule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<record model="stock.rule" id="stock_rule_a_to_b">
<field name="name">1 => 2 with auto_move</field>
<field name="action">pull</field>
<field name="location_id" ref="stock_location_b" />
<field name="location_dest_id" ref="stock_location_b" />
<field name="warehouse_id" ref="stock.warehouse0" />
<field name="route_id" ref="test_route" />
<field name="group_propagation_option">propagate</field>
Expand All @@ -18,7 +18,7 @@
<record model="stock.rule" id="auto_location_path">
<field name="name">Test push route 3=>1</field>
<field name="location_src_id" ref="stock_location_c" />
<field name="location_id" ref="stock_location_a" />
<field name="location_dest_id" ref="stock_location_a" />
<field name="picking_type_id" ref="stock.picking_type_internal" />
<field name="auto">transparent</field>
<field name="route_id" ref="test_route" />
Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr "Ruta de prova"

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr "Comprobar ruta"

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/es_MX.po
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr "Route d'essai"

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/hr.po
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr "Test rute"

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ msgid "Test push route 3=>1"
msgstr "Test forza percorso 3=>1"

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr "Test percorso"
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/nl_NL.po
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/pt_PT.po
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/sl.po
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr "Testna proga"

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/stock_auto_move.pot
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/tr.po
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/tr_TR.po
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion stock_auto_move/i18n/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ msgid "Test push route 3=>1"
msgstr ""

#. module: stock_auto_move
#: model:stock.location.route,name:stock_auto_move.test_route
#: model:stock.route,name:stock_auto_move.test_route
msgid "Test route"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions stock_auto_move/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def _auto_assign_quantities(self):
for move in self:
move.quantity_done = move.reserved_availability

def _action_assign(self):
res = super()._action_assign()
def _action_assign(self, force_qty=False):
res = super()._action_assign(force_qty=force_qty)
# Transfer all pickings which have an auto move assigned
moves = self.filtered(
lambda m: m.state in ("assigned", "partially_available") and m.auto_move
Expand Down
43 changes: 19 additions & 24 deletions stock_auto_move/tests/test_stock_auto_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Copyright 2020 ACSONE SA/NV (<https://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.tests.common import SavepointCase
from odoo.tests.common import TransactionCase


class TestStockAutoMove(SavepointCase):
class TestStockAutoMove(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down Expand Up @@ -249,7 +249,7 @@ def test_50_partial_chained_auto_move(self):
self.assertTrue(picking.move_line_ids)
self.assertEqual(len(picking.move_line_ids), 1)
picking.move_line_ids.qty_done = 1
picking.move_line_ids.product_uom_qty = 1
picking.move_line_ids.reserved_uom_qty = 1
picking._action_done()

# As move_dest_ids include backorders
Expand All @@ -274,11 +274,10 @@ def test_50_partial_chained_auto_move(self):
back_order.move_line_ids.qty_done = 1
back_order._action_done()

move2 = back_order.move_lines
self.assertEqual(len(move2.move_dest_ids), 2)
self.assertEqual(len(back_order.move_ids.move_dest_ids), 2)

self.assertEqual(move2.move_dest_ids.mapped("auto_move"), [True, True])
self.assertEqual(move2.move_dest_ids.mapped("state"), ["done", "done"])
self.assertEqual(back_order.move_ids.move_dest_ids.mapped("auto_move"), [True, True])
self.assertEqual(back_order.move_ids.move_dest_ids.mapped("state"), ["done", "done"])

def test_60_partial_chained_auto_move(self):
"""
Expand Down Expand Up @@ -347,10 +346,10 @@ def test_60_partial_chained_auto_move(self):

# do partial reception of the first picking
move1.move_line_ids.qty_done = 2
move1.move_line_ids.product_uom_qty = 2
move1.move_line_ids.reserved_uom_qty = 2

move2.move_line_ids.qty_done = 1
move2.move_line_ids.product_uom_qty = 1
move2.move_line_ids.reserved_uom_qty = 1

picking._action_done()

Expand All @@ -359,12 +358,12 @@ def test_60_partial_chained_auto_move(self):
)

self.assertEqual(second_step_picking.state, "done")
self.assertEqual(len(second_step_picking.move_lines), 1)
self.assertEqual(len(second_step_picking.move_line_ids), 1)
self.assertEqual(len(second_step_picking.move_line_ids), 1)

self.assertEqual(len(second_step_back_order.move_lines), 1)
self.assertEqual(len(second_step_back_order.move_line_ids), 1)
self.assertTrue(
second_step_back_order.move_lines.filtered(
second_step_back_order.move_line_ids.filtered(
lambda m: m.state == "partially_available"
)
)
Expand Down Expand Up @@ -523,10 +522,10 @@ def test_90_partial_chained_auto_move_no_backorder(self):

# do partial reception of the first picking
move1.move_line_ids.qty_done = 2
move1.move_line_ids.product_uom_qty = 2
move1.move_line_ids.reserved_uom_qty = 2

move2.move_line_ids.qty_done = 1
move2.move_line_ids.product_uom_qty = 1
move2.move_line_ids.reserved_uom_qty = 1

res = picking.button_validate()
self.assertEqual(res.get("res_model"), "stock.backorder.confirmation")
Expand Down Expand Up @@ -638,10 +637,10 @@ def test_100_partial_chained_auto_move_mixed_no_backorder(self):

# do partial reception of the first picking
move1.move_line_ids.qty_done = 5
move1.move_line_ids.product_uom_qty = 5
move1.move_line_ids.reserved_uom_qty = 5

move2.move_line_ids.qty_done = 5
move2.move_line_ids.product_uom_qty = 5
move2.move_line_ids.reserved_uom_qty = 5

res = picking.button_validate()
self.assertEqual(res.get("res_model"), "stock.backorder.confirmation")
Expand All @@ -654,9 +653,8 @@ def test_100_partial_chained_auto_move_mixed_no_backorder(self):

# We need to ensure that all moves are done or cancelled in the
# second picking
self.assertItemsEqual(
["done", "cancel"],
list(set(second_step_picking.move_lines.mapped("state"))),
self.assertTrue(
all(move_line.state in ("done", "cancel") for move_line in second_step_picking.move_line_ids),
)

# The second step picking should have a backorder for the
Expand All @@ -666,8 +664,5 @@ def test_100_partial_chained_auto_move_mixed_no_backorder(self):
)

self.assertTrue(second_step_back_order)
# If https://github.com/odoo/odoo/pull/66124 is integrated,
# this should become assigned as remaining quantity should be cancelled
# and quantities should be 5.0
self.assertEqual("partially_available", second_step_back_order.move_lines.state)
self.assertEqual(10.0, second_step_back_order.move_lines.product_uom_qty)
self.assertEqual("partially_available", second_step_back_order.move_line_ids.state)
self.assertEqual(5.0, second_step_back_order.move_line_ids.reserved_uom_qty)

0 comments on commit 7ea99d4

Please sign in to comment.