Skip to content

Commit

Permalink
[REF]stock_auto_move: avoid infinit loop when calling action_assing
Browse files Browse the repository at this point in the history
  • Loading branch information
zakiuu committed Oct 11, 2017
1 parent 2c5e80e commit f625b20
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions stock_auto_move/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@ def _get_auto_moves_by_pickings(self, auto_moves):

@api.multi
def action_assign(self, no_prepare=False):
res = super(StockMove, self).action_assign(no_prepare=no_prepare)

# Select auto moves that are assigned
auto_moves = self.filtered(
already_assigned_moves = self.filtered(
lambda m: m.state == 'assigned')

not_assigned_auto_move = self - already_assigned_moves

res = super(StockMove, self).action_assign(
no_prepare=no_prepare)

# Process only moves that have been processed recently
auto_moves = not_assigned_auto_move.filtered(
lambda m: m.state == 'assigned' and m.auto_move)

# group the moves by pickings
Expand Down

0 comments on commit f625b20

Please sign in to comment.