Skip to content

Commit

Permalink
Unlink empty picking when last move changes type
Browse files Browse the repository at this point in the history
  • Loading branch information
guewen committed Nov 19, 2019
1 parent 07a512f commit cc74339
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions stock_picking_type_routing_operation/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,15 @@ def _apply_move_location_src_routing_operation(self):
'picking_type_id': picking_type.id,
})
move._insert_src_routing_moves()

picking = move.picking_id
move._assign_picking()
if not picking.move_lines:
# When the picking type changes, it will create a new picking
# for the move. If the previous picking has no other move,
# we have to drop it.
picking.unlink()

move._action_assign()

def _insert_src_routing_moves(self):
Expand Down

0 comments on commit cc74339

Please sign in to comment.