Skip to content

Commit

Permalink
[MIG] sale_order_global_stock_route: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mmrondon committed Nov 6, 2024
1 parent 6d5414f commit 45769a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sale_order_global_stock_route/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Sale Order Global Stock Route",
"summary": "Add the possibility to choose one warehouse path for an order",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"development_status": "Beta",
"category": "Warehouse",
"website": "https://github.com/OCA/stock-logistics-workflow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ def setUpClass(cls):
super().setUpClass()
cls.partner = cls.env["res.partner"].create({"name": "Test"})
cls.product1 = cls.env["product.product"].create(
{"name": "test_product1", "type": "product"}
{"name": "test_product1", "type": "consu"}
)
cls.product2 = cls.env["product.product"].create(
{"name": "test_product2", "type": "product"}
{"name": "test_product2", "type": "consu"}
)
cls.route1 = cls.env["stock.route"].create(
{"name": "test_route_1", "sale_selectable": "True"}
Expand Down Expand Up @@ -61,7 +61,7 @@ def test_global_route02(self):
self.order["route_id"] = self.route1.id
for line in self.order.order_line:
line.global_stock_route_product_id_change()
self.assertTrue(line.route_id == self.route1)
self.assertEqual(line.route_id, self.order.route_id)

def test_routes_without_onchange(self):
new_order = self.env["sale.order"].create(
Expand Down Expand Up @@ -102,3 +102,14 @@ def test_routes_without_onchange(self):
new_order.write({"route_id": self.route2.id})
for line in new_order.order_line:
self.assertTrue(line.route_id == self.route2)

def test_create_order_line_inherits_route_id(self):
sale_order = self.env['sale.order'].create({
"partner_id": self.partner.id,
'route_id': self.route1.id,
})
order_line = self.env['sale.order.line'].create([{
'order_id': sale_order.id,
'product_id': self.product1.id,
}])
self.assertEqual(order_line.route_id, sale_order.route_id)

0 comments on commit 45769a8

Please sign in to comment.