-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
[14.0][IMP] stock_warehouse_flow: Improve flow matching #991
base: 14.0
Are you sure you want to change the base?
Changes from 1 commit
5f3f161
a72999c
1852829
6850896
7a75420
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,31 @@ | |
|
||
|
||
class TestWarehouseFlow(common.CommonFlow): | ||
def test_flow_search_after_applied(self): | ||
flow_ship_only = self._get_flow("ship_only") | ||
flow_pick_ship = self._get_flow("pick_ship") | ||
moves_before = self.env["stock.move"].search([]) | ||
self._run_procurement(self.product, 10, flow_pick_ship.carrier_ids) | ||
moves = self.env["stock.move"].search([("id", "not in", moves_before.ids)]) | ||
move_ship = moves.filtered(lambda m: m.picking_type_id.code == "outgoing") | ||
# When flow was applied to move, picking type set by odoo was saved | ||
# in default_picking_type_id, and flow.to_picking_type_id is set | ||
self.assertEqual(move_ship.picking_type_id, flow_pick_ship.to_picking_type_id) | ||
default_type = self.env.ref("stock.picking_type_out") | ||
self.assertEqual(move_ship.default_picking_type_id, default_type) | ||
# Only pick_ship matches, because there's a constraint on the carrier | ||
matching_flows = self.env["stock.warehouse.flow"]._search_for_move(move_ship) | ||
self.assertEqual(matching_flows, flow_pick_ship) | ||
# Drop the carrier from the procurement, only direct flow should match | ||
move_ship.group_id.carrier_id = False | ||
matching_flows = self.env["stock.warehouse.flow"]._search_for_move(move_ship) | ||
self.assertEqual(matching_flows, flow_ship_only) | ||
# Drop default_picking_type_id, no flow is found, because | ||
# now flow has Delivery Orders POST as from_picking_type_id | ||
Comment on lines
+30
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure to understand this comment. Current move operation type (which has been updated at the beginning) doesn't match any flows? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You create the move with picking type A. |
||
move_ship.default_picking_type_id = False | ||
matching_flows = self.env["stock.warehouse.flow"]._search_for_move(move_ship) | ||
self.assertFalse(matching_flows) | ||
|
||
def test_flow_ship_only(self): | ||
"""Replace the initial move by a 'ship_only' move.""" | ||
# NOTE: use the recorder when migrating to 15.0 to catch created moves | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as "direct" is used for shipping policy (confusing)