odoo/odoo#191114

Created by fw-bot
Merged at bc141cd233255750ae0efed0f917035aaff9d810

Statuses:

label
odoo-dev:master-17.0-opw-4358121-picking_lot-lase-t8h7-fw
head
9c228dafdeff6fae38d677a1371659ad6af5505b
merged
9 months ago by Bugfix, Lancelot Semal (lase)
odoo/odoo
17.0 #188840
saas-17.2 #189009
saas-17.4 #191080
18.0 #191086
saas-18.2
saas-18.3
saas-18.4
19.0
master #191114

[FW][FIX] stock: onchange lot on moves to reassign move lines

Initial issue:

On a stock move, when using a lot from a sub-location, the created SML will still start from SM's source location instead of lot's location

This issue was fixed in:

However, there is a tiny corner case where the fix of 17.0 is better than the one of saas-17.2:
If you were to put half of a lot in a pack in a sublocation and the other half eslewhere, the current fix of saas-17.2 would not use the sublocation that is however available as it relies on the 'location_id' field of the stock.lot model which will not be set in that valid use case:
https://github.com/odoo/odoo/blob/d9cca6201a39c431deaf13891a314dde2db7e82e/addons/stock/models/stock_lot.py#L155-L159

The purpose of the present PR is to reconcile both fix by reverting the current one and by adapting the test to both usecases.

Revert "[FIX] stock: start SML from sub location"

This reverts commit 8dec391fff243b4d079ceafd6c19b84008d2fe36.

I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #189009
Forward-Port-Of: #188840