Skip to content
Snippets Groups Projects
Commit d54a806c authored by Adrien Widart's avatar Adrien Widart
Browse files

[FIX] point_of_sale: use correct location_id

To reproduce the error:
1. In Settings, enable "Multi-Step Routes"
2. Create a storable product P
    - Available in POS
3. Update P's quantity:
    - Location: WH/Stock/Shelf 1
    - On Hand Quantity: 1
4. In a POS session, process an order with one P
5. Close the session
6. Consult P's moves

Error: The location used to sell P is Stock instead of Stock/Shelf 1

At some point, the step 5 triggers `_create_move_from_pos_order_lines`.
Because "Consignment" isn't checked in the settings, the if-blocked is
skipped and therefore the move isn't assigned:
https://github.com/odoo/odoo/blob/4bcc63cf49a8c3ab73812de3d171024aa8059b8f/addons/point_of_sale/models/stock_picking.py#L152-L161
Then, on L161, when setting `quantity_done`, it triggers the inverse
method `_quantity_done_set` which will create a SML (because there isn't
one yet):
https://github.com/odoo/odoo/blob/2841525a3a2f1273783874947884b57494def849/addons/stock/models/stock_move.py#L355-L359


but using the location of the move (i.e. Stock)

The if-condition was introduced with d59fc6c9
to fix another issue. In the meantime, another fix has been deployed for
a second issue fe4323b5 However, this
second commit also fixes the first issue, therefore the if-condition is
no longer required. As a result, `_action_assign` will be called and a
SML with the correct location will be created.

OPW-2607748

closes odoo/odoo#75090

Signed-off-by: default avatarpimodoo <pimodoo@users.noreply.github.com>
parent 6968c6c5
Branches
Tags
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment