From 9b95bb79044f3c01f42651c0995e17aec696176f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 20 Feb 2020 11:40:40 +0000 Subject: [PATCH] [FIX] stock: immediate transfer in multi-step - Activate multi-step routes - Set Incoming Shipments: Receive goods in input, then quality and then stock (3 steps) - Create an Immediate Transfer from 'WH/Input' to 'WH/Quality Control' - Add 2 products, set a quantity - Validate Two immediate transfers are created, one for each product, while a single planned transfer is expected. This is because the `default_immediate_transfer`i key is polluting the context. opw-2180556 opw-2197720 closes odoo/odoo#45843 X-original-commit: 74ad073fd66ca4ff345aaf37a7245a8b93808cb3 Signed-off-by: Nicolas Martinelli (nim) --- addons/stock/models/stock_picking.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 3fb316194db..5ee5baff1b9 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -824,6 +824,12 @@ class Picking(models.Model): picking.package_level_ids.filtered(lambda p: not p.move_ids).unlink() def button_validate(self): + # Clean-up the context key at validation to avoid forcing the creation of immediate + # transfers. + ctx = dict(self.env.context) + ctx.pop('default_immediate_transfer', None) + self = self.with_context(ctx) + # Sanity checks. pickings_without_moves = self.browse() pickings_without_quantities = self.browse()