[FIX] stock: immediate transfer

- Install Purchase
- Activate multi-step routes, multi warehouses and packaging
- Create 2 wharehouses WH1 et WH2
- 'WH1: Receipts' and 'WH2: Receipts'
  Show Detailed Operations: True
  Pre-fill Detailed Operations: True
  Move Entire Packages: True
- 'WH1: Internal Transfers'
  Show Detailed Operations: True
  Move Entire Packages: True
- Create a route 'WH1 -> WH2':
  Applicable On WH1
  Rule:
    Action: Push To
    Operation Type: WH2: Receipts
    Source Location: Virtual Locations/Inter Company Transit
    Destination Locaion: WH2/Stock
    Automatic Move: Manual Operation
- Create a PO for 100 units of P1 and P2, validate
- Go to the picking, set 40 units done for P1 and P2
  => Put in Pack
- Set 60 units done for P1 and P2
  => Put in Pack
- Validate
- Create an Internal Transfer in WH1:
  Operation Type: WH1: Internal Transfers
  Source Location: WH1/Stock
  Destination Location: Virtual Locations/Inter Company Transit
- Add the 2 packages previously created, save and validate

4 pickings are created in 'WH2: Receipts': 40 P1, 40 P2, 60 P1 and 60
P2. There should only be one picking with the 2 packages.

The issue is similar to 2d4a743600f4501bbbed60a063ea2a87f1bce075: the
`default_immediate_transfer` context key pollutes the creation of the
pickings.

opw-2197720

closes odoo/odoo#48038

X-original-commit: 6e5cfb62b43f0781c246e9a27259e63199203221
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
Nicolas Martinelli
2020-03-19 14:59:28 +00:00
parent 38fab0afcf
commit b42e9c4547
+4
View File
@@ -989,6 +989,10 @@ class Picking(models.Model):
if the picking is a planned transfer and one of its move was added after the initial
call to `action_confirm`. Note that `action_confirm` will only work on draft moves.
"""
# Clean-up the context key to avoid forcing the creation of immediate transfers.
ctx = dict(self.env.context)
ctx.pop('default_immediate_transfer', None)
self = self.with_context(ctx)
for picking in self:
if picking.state in ('done', 'cancel'):
continue