From 7333f5e9b8ac8909af45def63002bd26a234e79d Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 20 Jul 2017 13:44:43 +0200 Subject: [PATCH] [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 --- addons/purchase/purchase.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index aab374efd56..23f1f8bebef 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -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