Skip to content
Snippets Groups Projects
Commit 861d941a authored by Touati Djamel (otd)'s avatar Touati Djamel (otd)
Browse files

[FIX] stock_picking_batch: put in pack move lines from different picking

Steps to reproduce the bug:
- Enable “package” option in the settings
- Create a storable product “P1”
- update the stock to 100
- Create a picking:
    - product : P1
    - Qty: 1
    - operation type: delivery
    - go to additional info > add a carrier
    - Mark as todo
    - update the qty done to 1
- Create a second picking with the same steps

- Create a batch picking:
    - Add the picking 1 and 2
    - Confirm
    - Go to “Detailed operation” tab
    - Click on “Put in pack”
    - add a “Delivery packaging”
    - Save
    - Click a second time on “Put in pack”
    - Select the same “Delivery packaging”
    - Save

Problem:
Traceback is triggered: “tuple index out of range”

When the “Put in pack” button is clicked, the “action_put_in_pack”
function is called, the move_line_ids which has no package or with
a 0 quantity done are filtered, in this case the 2nd move_line with
the product “P2” will be used, but the `_pre_put_in_pack_hook` function
is not called with its picking:

https://github.com/odoo/odoo/blob/14.0/addons/stock_picking_batch/models/stock_picking_batch.py#L229

But rather with the first picking, it will have no move_line because the
first move_line already has a quantity done at 1 and a package.
So we try to get a record in an empty array:
https://github.com/odoo/odoo/blob/14.0/addons/stock/models/stock_picking.py#L1312



opw-3067921

closes odoo/odoo#106864

X-original-commit: 1b6208a2
Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
Signed-off-by: default avatarDjamel Touati (otd) <otd@odoo.com>
parent 67abc6c8
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment