Skip to content

Commit

Permalink
[FIX] stock: immediate transfer
Browse files Browse the repository at this point in the history
- 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 2d4a743: the
`default_immediate_transfer` context key pollutes the creation of the
pickings.

opw-2197720

closes odoo#48013

Signed-off-by: Simon Lejeune (sle) <[email protected]>
  • Loading branch information
nim-odoo committed Mar 19, 2020
1 parent 2826214 commit 3bf5e60
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions addons/stock/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,10 @@ def _check_backorder(self):
return any(quantity_done[x] < quantity_todo.get(x, 0) for x in quantity_done)

def _autoconfirm_picking(self):
# 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.filtered(lambda picking: picking.immediate_transfer and picking.state not in ('done', 'cancel') and (picking.move_lines or picking.package_level_ids)):
picking.action_confirm()

Expand Down

0 comments on commit 3bf5e60

Please sign in to comment.