Skip to content

Commit

Permalink
stock_dynamic_routing: add test
Browse files Browse the repository at this point in the history
Add test for the rerouting of waiting moves in a pull flow
  • Loading branch information
jbaudoux committed Aug 17, 2023
1 parent e807d66 commit 62a4b43
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions stock_dynamic_routing/tests/test_routing_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,3 +1057,54 @@ def test_mix_routing_reservation_same_location(self):
{"location_id": self.location_hb_1_2.id, "product_uom_qty": 7},
],
)

def test_route_waiting_moves(self):
"""Routing of waiting moves.
When the initial move is rerouted, the waiting moves in the chain
are also rerouted in cascade even if the destination location of the
initial move is not changed.
"""
# make a routing that does not change locations
self.pick_type_routing_op.write(
{
"default_location_src_id": self.wh.pick_type_id.default_location_src_id,
"default_location_dest_id": self.wh.pick_type_id.default_location_dest_id,
}
)
self.routing.location_id = (
self.pick_type_routing_op.default_location_src_id.id,
)
out_type_routing = self.wh.out_type_id.copy(
{"name": "OUTP Routing", "sequence_code": "WH/OUTP"}
)
self.env["stock.routing"].create(
{
"location_id": out_type_routing.default_location_src_id.id,
"picking_type_id": self.wh.out_type_id.id,
"rule_ids": [
(0, 0, {"method": "pull", "picking_type_id": out_type_routing.id})
],
}
)
pick_picking, customer_picking = self._create_pick_ship(
self.wh, [(self.product1, 10)]
)
self._update_product_qty_in_location(self.location_shelf_1, self.product1, 20.0)
pick_picking.action_assign()
new_cust_picking = self.env["stock.picking"].search(
[("picking_type_id", "=", out_type_routing.id)]
)

self.assertEqual(len(new_cust_picking), 1)
self.assertRecordValues(
new_cust_picking,
[
{
"state": "waiting",
"location_id": self.wh.wh_output_stock_loc_id.id,
"location_dest_id": self.customer_loc.id,
"picking_type_id": out_type_routing.id,
}
],
)

0 comments on commit 62a4b43

Please sign in to comment.