From 29d8fc091ab5b37f79156c736bfa027a816c1c7a Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Tue, 29 Oct 2019 09:25:10 +0000 Subject: [PATCH] [FIX] stock: picking: immediate and state Issue: create an immediate transfer, add a move and a done quantity, the picking is in waiting state instead of ready. Due to rev[0], the moves added in an immediate transfer have an initial demand. After auto-confirming them, their state were 'confirmed' and not 'assigned'. Solution: we force the state to assigned [0] 8303b1a69e96807bcb548ef079dcb463e34df36b closes odoo/odoo#39492 Signed-off-by: Simon Lejeune (sle) --- addons/stock/models/stock_picking.py | 3 +++ addons/stock/tests/test_move2.py | 1 + 2 files changed, 4 insertions(+) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index f8d35c3396f..472752f5a6c 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -907,6 +907,9 @@ class Picking(models.Model): continue if picking.immediate_transfer or any(move.additional for move in picking.move_lines): picking.action_confirm() + # Make sure the reservation is bypassed in immediate transfer mode. + if picking.immediate_transfer: + picking.move_lines.write({'state': 'assigned'}) def _create_backorder(self): """ This method is called when the user chose to create a backorder. It will create a new diff --git a/addons/stock/tests/test_move2.py b/addons/stock/tests/test_move2.py index f4932803b1e..1ed13fa6141 100644 --- a/addons/stock/tests/test_move2.py +++ b/addons/stock/tests/test_move2.py @@ -1880,6 +1880,7 @@ class TestSinglePicking(TestStockCommon): 'product_uom': self.productA.uom_id.id, 'location_id': self.stock_location, 'location_dest_id': self.customer_location, + 'quantity_done': 5, })], }) self.assertEqual(delivery_order.state, 'assigned')