[FIX] purchase: Wrong scheduled date for backorder
Steps to reproduce: -Create a PO with two lines L1 and L2 -L1 has product P with qty=10 for a scheduled date=23/07/2017 -L2 has product P with qty=10 for a scheduled date=30/07/2017 -Confirm the PO When delivering 5P of L1, the scheduled date of the picking is the right date which is 23/07/2017 But when delivering the other 5P of L1, the scheduled date of the second picking was 30/07/2017 instead of 23/07/2017. opw:752192
This commit is contained in:
@@ -357,6 +357,10 @@ class PurchaseOrder(models.Model):
|
||||
picking = self.env['stock.picking'].create(res)
|
||||
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:
|
||||
seq += 5
|
||||
move.sequence = seq
|
||||
moves = self.env['stock.move'].browse(move_ids)
|
||||
moves.force_assign()
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user