From bdd5ec8216d375ef2baf3e9903c394a8f13061a1 Mon Sep 17 00:00:00 2001
From: Denis Ledoux <dle@odoo.com>
Date: Thu, 11 Dec 2014 15:57:54 +0100
Subject: [PATCH] [FIX] stock: reload after stock picking scrap

If a wizard is launched from an embedded view list, only the record of the line from which the wizard was launched is reloaded after closing the wizard.

In this specific case, as new lines are added to the picking, we need to fully reload the stock picking
---
 addons/stock/wizard/stock_move.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py
index f4027b4131e0..7016494572db 100644
--- a/addons/stock/wizard/stock_move.py
+++ b/addons/stock/wizard/stock_move.py
@@ -86,7 +86,18 @@ class stock_move_scrap(osv.osv_memory):
             move_obj.action_scrap(cr, uid, move_ids,
                              data.product_qty, data.location_id.id, restrict_lot_id=data.restrict_lot_id.id,
                              context=context)
-        return {'type': 'ir.actions.act_window_close'}
+        if context.get('active_id'):
+            move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
+            return {
+                'view_type': 'form',
+                'view_mode': 'form',
+                'res_model': 'stock.picking',
+                'type': 'ir.actions.act_window',
+                'res_id': move.picking_id.id,
+                'context': context
+            }
+        else:
+            return {'type': 'ir.actions.act_window_close'}
 
 
 
-- 
GitLab