Skip to content
Snippets Groups Projects
Commit 0a2be241 authored by Yolann Sabaux's avatar Yolann Sabaux
Browse files

[FIX] mrp, stock: select correct preferred route

Steps to reproduce:
- Create two extra warehouses (B and C):
 * Warehouse B: Resupply from San Francisco
 * Warehouse C: Resupply from San Francisco
- Create a new Product:
 * Storable
 * Inventory > Routes: select only Warehouse B and Warehouse C
- Create a new Move:
 * From WHC to a Customer
 * Confirm the order

Issue:
In replenishment, the defined prefered route will be Warehouse B

Cause:
When the replenishment view is loaded, in
https://github.com/odoo/odoo/blob/5757502a79c920e1aa4c7ca1c581c533907ce674/addons/stock/models/stock_orderpoint.py#L427


The preferred route (route_id) is defined as the first element of the routes defined for the produc which is wrong.

Solution:
Filter the route_ids by selecting the route for which the supplied warehouse is equal to the warehouse selected for the orderpoint.

Note:
The test in "test_bom" has been modified because it was using the wrong flow (a route should have been set by default)
opw-2815462

closes odoo/odoo#89739

X-original-commit: b5bd03f9
Signed-off-by: default avatarAdrien Widart <awt@odoo.com>
Signed-off-by: default avataryosa-odoo <yosa@odoo.com>
parent 4811b842
No related branches found
No related tags found
No related merge requests found
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