[FIX] mrp_multi_level: adapt tests to recent upstream changes.

After 1ed6dbeae5
we need to explicitly set routes in the propoer order becouse while
in the cache there are not yet sorted by sequence (it requires flush
to the database, which we cannot do in a test).
This commit is contained in:
Lois Rilo
2024-11-28 16:49:38 +01:00
parent 34d0a090ae
commit caeefa6ada

View File

@@ -444,8 +444,18 @@ class TestMrpMultiLevel(TestMrpMultiLevelCommon):
self.fp_4.route_ids = [(4, self.env.ref("mrp.route_warehouse0_manufacture").id)]
product_mrp_area._compute_supply_method()
self.assertEqual(product_mrp_area.supply_method, "manufacture")
# because of the issue discussed here https://github.com/odoo/odoo/pull/188846
# we need to apply routes explicitly in the proper order (by sequence)
self.fp_4.route_ids = [
(4, self.env.ref("purchase_stock.route_warehouse0_buy").id)
(
6,
0,
(
self.env.ref("stock.route_warehouse0_mto")
+ self.env.ref("purchase_stock.route_warehouse0_buy")
+ self.env.ref("mrp.route_warehouse0_manufacture")
).ids,
)
]
product_mrp_area._compute_supply_method()
self.assertEqual(product_mrp_area.supply_method, "buy")