[FIX] purchase: Wrong scheduled date for backorder

Fine tuning of this commit:7333f5e

When the PO lines were not ordered according to the scheduled date,
the scheduled date of the picking was wrong when delivering.

opw:752192
This commit is contained in:
Goffin Simon
2017-07-31 10:28:24 +02:00
parent 3bda87a8d3
commit 6fe846ec2f
+1 -1
View File
@@ -358,7 +358,7 @@ class PurchaseOrder(models.Model):
moves = order.order_line.filtered(lambda r: r.product_id.type in ['product', 'consu'])._create_stock_moves(picking)
move_ids = moves.action_confirm()
seq = 0
for move in moves:
for move in sorted(moves, key=lambda move: move.date_expected):
seq += 5
move.sequence = seq
moves = self.env['stock.move'].browse(move_ids)