diff --git a/addons/stock/tests/test_move2.py b/addons/stock/tests/test_move2.py index b33046f4eae..e6773e93fd9 100644 --- a/addons/stock/tests/test_move2.py +++ b/addons/stock/tests/test_move2.py @@ -23,7 +23,7 @@ class TestPickShip(TestStockCommon): 'location_dest_id': self.customer_location, 'state': 'waiting', }) - + picking_pick = self.env['stock.picking'].create({ 'location_id': self.stock_location, 'location_dest_id': self.pack_location, @@ -701,3 +701,48 @@ class TestSinglePicking(TestStockCommon): self.assertEqual(len(move1.move_line_ids), 2) self.assertEqual(move1.move_line_ids[0].lot_id.id, serial1.id) self.assertEqual(move1.move_line_ids[1].lot_id.id, serial2.id) + + def test_add_move_when_picking_is_available_1(self): + """ Check that any move added in a picking once it's assigned is directly considered as + assigned and bypass the reservation. + """ + delivery_order = self.env['stock.picking'].create({ + 'location_id': self.pack_location, + 'location_dest_id': self.customer_location, + 'partner_id': self.partner_delta_id, + 'picking_type_id': self.picking_type_out, + }) + self.MoveObj.create({ + 'name': self.productA.name, + 'product_id': self.productA.id, + 'product_uom_qty': 2, + 'product_uom': self.productA.uom_id.id, + 'picking_id': delivery_order.id, + 'location_id': self.pack_location, + 'location_dest_id': self.customer_location, + }) + + # make some stock + pack_location = self.env['stock.location'].browse(self.pack_location) + self.env['stock.quant']._update_available_quantity(self.productA, pack_location, 2) + + # assign + delivery_order.action_confirm() + delivery_order.action_assign() + self.assertEqual(delivery_order.state, 'assigned') + + # add a move + move2 = self.MoveObj\ + .with_context(default_picking_id=delivery_order.id)\ + .create({ + 'name': self.productA.name, + 'product_id': self.productB.id, + 'product_uom_qty': 1, + 'product_uom': self.productA.uom_id.id, + 'picking_id': delivery_order.id, + 'location_id': self.pack_location, + 'location_dest_id': self.customer_location, + }) + + self.assertEqual(move2.state, 'assigned') + self.assertEqual(delivery_order.state, 'assigned') diff --git a/addons/stock_account/views/stock_account_views.xml b/addons/stock_account/views/stock_account_views.xml index e6e570a8184..fa14fc21e6b 100644 --- a/addons/stock_account/views/stock_account_views.xml +++ b/addons/stock_account/views/stock_account_views.xml @@ -27,17 +27,6 @@ - - stock.picking.form.inherit - stock.picking - - - - {'address_in_id': partner_id, 'form_view_ref':'stock.view_move_picking_form', 'tree_view_ref':'stock.view_move_picking_tree', 'default_picking_type_id': picking_type_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id} - - - - stock.return.picking.stock.account.form