[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] 8303b1a69e

closes odoo/odoo#39492

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
Simon Lejeune
2019-11-13 15:40:40 +00:00
parent 4d653af6e9
commit 29d8fc091a
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -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
+1
View File
@@ -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')