Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] stock_auto_move #1797

Open
wants to merge 40 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1b64e31
Added stock_auto_move module
npiganeau Nov 20, 2015
abdbb53
stock_auto_move : OCA compliant
Nov 23, 2015
ab550ed
stock_auto_move : replace utf8 by utf-8, use camelcase in class name
Nov 24, 2015
15ba43e
Refactorings
npiganeau Nov 27, 2015
700bbc3
stock_auto_move: externalize change group to be able to overload it
Dec 4, 2015
e0e11ed
Use new api mapped instead of ids list comprehension
npiganeau Dec 9, 2015
57fc271
OCA Transbot updated translations from Transifex
oca-transbot Jul 3, 2016
f4b3aa9
[10.0] port stock_auto_move to 10.0
May 15, 2017
2b01201
OCA Transbot updated translations from Transifex
oca-transbot Jun 3, 2017
34b1c01
OCA Transbot updated translations from Transifex
oca-transbot Jun 24, 2017
85aa5d3
[FIX] stock_auto_move: action_assign on stock_move should have an opt…
May 15, 2017
6cd5323
OCA Transbot updated translations from Transifex
oca-transbot Mar 3, 2018
935fb54
[UPD] Update stock_auto_move.pot
oca-travis Jun 23, 2018
1422da5
[ADD] icon.png
OCA-git-bot Apr 3, 2019
010f001
[IMP] stock_auto_move: black, isort, prettier
rousseldenis Nov 13, 2020
887abb3
[13.0][MIG] stock_auto_move: Migration to v13.0
rousseldenis Nov 13, 2020
d6c1361
[IMP]stock_auto_move: auto move from push rules
zakiuu Sep 5, 2017
7d95cd9
[9.0][REF]stock_auto_move: fix action_assign() (#373)
zakiuu Oct 1, 2018
a44f486
[10.0][IMP] stock_auto_move: auto_confirm=>auto_move
rousseldenis Nov 18, 2020
c6b461c
[13.0][IMP] stock_auto_move: Take into account partial moves
rousseldenis Nov 18, 2020
76cec4d
[13.0][FIX] stock_auto_move: Don't change procurement group if exists
rousseldenis Feb 10, 2021
456faaf
[13.0][IMP] stock_auto_move: Add tests for procurement group
rousseldenis Feb 10, 2021
f77a41b
[13.0][FIX] stock_auto_move: Use correct quantity field
rousseldenis Feb 10, 2021
6032fc0
[13.0][IMP] stock_auto_move: Take into account cases with mixed moves
rousseldenis Feb 11, 2021
fe8f6d2
[13.0][IMP] stock_auto_move: Take into account 'No backorder' process
rousseldenis Feb 13, 2021
8d2f858
[13.0][IMP] stock_auto_move: Take into account cases with mixed moves…
rousseldenis Feb 26, 2021
b4254b7
[14.0][MIG] - stock_auto_move
sbejaoui Jun 10, 2021
7c0e408
[UPD] Update stock_auto_move.pot
oca-travis Jul 5, 2021
ed31f14
[UPD] README.rst
OCA-git-bot Jul 5, 2021
e65c56c
Translated using Weblate (Catalan)
Jan 26, 2022
9b4e715
[UPD] README.rst
OCA-git-bot Sep 3, 2023
3298253
Update translation files
weblate Oct 9, 2023
583a895
Translated using Weblate (Italian)
mymage Dec 26, 2023
e8c9273
[MIG] stock_auto_move: Migration to 16.0
ThomasBinsfeld Dec 28, 2023
5c865e4
[UPD] Update stock_auto_move.pot
Mar 9, 2024
79ede69
Update translation files
weblate Mar 9, 2024
55a9b6f
Update translation files
weblate Mar 9, 2024
bf4e264
Translated using Weblate (Portuguese (Brazil))
May 29, 2024
a351b07
[IMP] stock_move_auto_reserve: black, isort, prettier
ferran-S73 Dec 19, 2024
087c6e6
[17.0][MIG] stock_auto_move
ferran-S73 Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 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": "16.0.1.0.0",
"version": "17.0.1.0.0",
"author": "NDP Systèmes, ACSONE SA/NV, Odoo Community Association (OCA)",
"category": "Warehouse",
"development_status": "Production/Stable",
Expand Down
19 changes: 2 additions & 17 deletions stock_auto_move/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2014-2015 NDP Systèmes (<https://www.ndp-systemes.fr>)
# Copyright 2020 ACSONE SA/NV (<https://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo import fields, models


class StockMove(models.Model):
Expand All @@ -15,7 +15,7 @@ class StockMove(models.Model):

def _auto_assign_quantities(self):
for move in self:
move.quantity_done = move.reserved_availability
move.picked = True

def _action_assign(self, force_qty=False):
res = super()._action_assign(force_qty=force_qty)
Expand All @@ -34,21 +34,6 @@ def _action_assign(self, force_qty=False):
moves.mapped("picking_id")._create_backorder()
return res

@api.model
def _get_auto_moves_by_pickings(self, auto_moves):
"""Group moves by picking.
@param auto_moves: stock.move data set
@return dict dict of moves grouped by pickings
{stock.picking(id): stock.move(id1, id2, id3 ...), ...}
"""
auto_moves_by_pickings = dict()
for move in auto_moves:
if move.picking_id in auto_moves_by_pickings:
auto_moves_by_pickings[move.picking_id] |= move
else:
auto_moves_by_pickings.update({move.picking_id: move})
return auto_moves_by_pickings

def _change_procurement_group(self):
automatic_group = self.env.ref("stock_auto_move.automatic_group")
moves = self.filtered(lambda m: m.auto_move and not m.group_id)
Expand Down
41 changes: 19 additions & 22 deletions stock_auto_move/tests/test_stock_auto_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ def test_10_auto_move(self):
}
)
move3._action_confirm()
self.env["stock.quant"]._update_available_quantity(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ferran-S73 Why is this necessary ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rousseldenis The move was not reserving stock because there was no available stock of the product. Maybe in older versions some other module added stock for the product?

self.product_a1232, self.location_shelf, 25, 0
)
move3._action_assign()
move3.quantity_done = move3.product_qty
move3.picked = True
move3._action_done()
move._action_assign()
move2._action_assign()
Expand Down Expand Up @@ -195,7 +198,7 @@ def test_40_chained_auto_move(self):
picking.action_confirm()
self.assertTrue(picking.move_line_ids)
self.assertEqual(len(picking.move_line_ids), 1)
picking.move_line_ids.qty_done = 2
picking.move_line_ids.picked = True
picking._action_done()
self.assertTrue(move1.move_dest_ids)

Expand Down Expand Up @@ -248,8 +251,7 @@ def test_50_partial_chained_auto_move(self):
picking.action_confirm()
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.reserved_uom_qty = 1
picking.move_line_ids.write({"picked": True, "quantity": 1})
picking._action_done()

# As move_dest_ids include backorders
Expand All @@ -271,7 +273,8 @@ def test_50_partial_chained_auto_move(self):
self.assertTrue(back_order)
self.assertEqual(len(back_order), 1)

back_order.move_line_ids.qty_done = 1
# back_order.move_line_ids.qty_done = 1
back_order.move_line_ids.picked = True
back_order._action_done()

self.assertEqual(len(back_order.move_ids.move_dest_ids), 2)
Expand Down Expand Up @@ -349,11 +352,9 @@ def test_60_partial_chained_auto_move(self):
move2.move_dest_ids.auto_move = False

# do partial reception of the first picking
move1.move_line_ids.qty_done = 2
move1.move_line_ids.reserved_uom_qty = 2
move1.move_line_ids.write({"picked": True, "quantity": 2})

move2.move_line_ids.qty_done = 1
move2.move_line_ids.reserved_uom_qty = 1
move2.move_line_ids.write({"picked": True, "quantity": 1})

picking._action_done()

Expand Down Expand Up @@ -452,13 +453,13 @@ def test_80_chained_auto_move_uom(self):
picking.action_confirm()
self.assertTrue(picking.move_line_ids)
self.assertEqual(len(picking.move_line_ids), 1)
picking.move_line_ids.qty_done = 2
picking.move_line_ids.picked = True
picking._action_done()
self.assertTrue(move1.move_dest_ids)

self.assertTrue(move1.move_dest_ids.auto_move)
self.assertEqual(move1.move_dest_ids.state, "done")
self.assertEqual(move1.move_dest_ids.quantity_done, 2.0)
self.assertEqual(move1.move_dest_ids.quantity, 2.0)
self.assertEqual(move1.move_dest_ids.product_qty, 24.0)

def test_90_partial_chained_auto_move_no_backorder(self):
Expand Down Expand Up @@ -525,11 +526,9 @@ def test_90_partial_chained_auto_move_no_backorder(self):
second_step_picking = move2.move_dest_ids.picking_id

# do partial reception of the first picking
move1.move_line_ids.qty_done = 2
move1.move_line_ids.reserved_uom_qty = 2
move1.move_line_ids.write({"picked": True, "quantity": 2})

move2.move_line_ids.qty_done = 1
move2.move_line_ids.reserved_uom_qty = 1
move2.move_line_ids.write({"picked": True, "quantity": 1})

res = picking.button_validate()
self.assertEqual(res.get("res_model"), "stock.backorder.confirmation")
Expand All @@ -548,8 +547,8 @@ def test_90_partial_chained_auto_move_no_backorder(self):

self.assertEqual("done", move1.move_dest_ids.state)
self.assertEqual("done", move2.move_dest_ids.state)
self.assertEqual(2.0, move1.move_dest_ids.quantity_done)
self.assertEqual(1.0, move2.move_dest_ids.quantity_done)
self.assertEqual(2.0, move1.move_dest_ids.quantity)
self.assertEqual(1.0, move2.move_dest_ids.quantity)

def test_100_partial_chained_auto_move_mixed_no_backorder(self):
"""
Expand Down Expand Up @@ -640,11 +639,9 @@ def test_100_partial_chained_auto_move_mixed_no_backorder(self):
second_step_picking = move2.move_dest_ids.picking_id

# do partial reception of the first picking
move1.move_line_ids.qty_done = 5
move1.move_line_ids.reserved_uom_qty = 5
move1.move_line_ids.write({"picked": True, "quantity": 5})

move2.move_line_ids.qty_done = 5
move2.move_line_ids.reserved_uom_qty = 5
move2.move_line_ids.write({"picked": True, "quantity": 5})

res = picking.button_validate()
self.assertEqual(res.get("res_model"), "stock.backorder.confirmation")
Expand Down Expand Up @@ -674,4 +671,4 @@ def test_100_partial_chained_auto_move_mixed_no_backorder(self):
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)
self.assertEqual(5.0, second_step_back_order.move_line_ids.quantity)
Loading