[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) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-02-20 15:44:28 +00:00
parent 3d3e8f3187
commit 9b95bb7904
+6
View File
@@ -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()