[FIX] stock: scrap creates a back order.
When the user scrap a product in a picking. The moves to proccess are moved to a back order and the current picking only contains the scrap move. It happens because scrap use action done on the scrap move and action done process the given move and put the other in a back order. This commit add a condition on back order creation in order to not do it if it comes from a scap.
This commit is contained in:
@@ -996,6 +996,11 @@ class StockMove(models.Model):
|
||||
picking = self and self[0].picking_id or False
|
||||
moves_todo.write({'state': 'done', 'date': fields.Datetime.now()})
|
||||
moves_todo.mapped('move_dest_ids')._action_assign()
|
||||
|
||||
# We don't want to create back order for scrap moves
|
||||
if all(move_todo.scrapped for move_todo in moves_todo):
|
||||
return moves_todo
|
||||
|
||||
if picking:
|
||||
moves_to_backorder = picking.move_lines.filtered(lambda x: x.state not in ('done', 'cancel'))
|
||||
if moves_to_backorder:
|
||||
|
||||
Reference in New Issue
Block a user