|
3 | 3 |
|
4 | 4 | @tagged("post_install", "-at_install")
|
5 | 5 | class TestModuleFlow(TransactionCase):
|
6 |
| - def setUp(self): |
7 |
| - super(TestModuleFlow, self).setUp() |
8 |
| - self.local_delivery = self.env.ref( |
| 6 | + @classmethod |
| 7 | + def setUpClass(cls): |
| 8 | + super().setUpClass() |
| 9 | + cls.local_delivery = cls.env.ref( |
9 | 10 | "delivery.delivery_local_delivery", raise_if_not_found=False
|
10 | 11 | )
|
11 |
| - self.poste_delivery = self.env.ref( |
| 12 | + cls.poste_delivery = cls.env.ref( |
12 | 13 | "delivery.delivery_carrier", raise_if_not_found=False
|
13 | 14 | )
|
14 |
| - self.warehouse0 = self.env["stock.warehouse"].create( |
| 15 | + cls.warehouse0 = cls.env["stock.warehouse"].create( |
15 | 16 | {
|
16 | 17 | "name": "Test Warehouse #1",
|
17 | 18 | "code": "TWH-1",
|
18 | 19 | }
|
19 | 20 | )
|
20 |
| - self.warehouse1 = self.env["stock.warehouse"].create( |
| 21 | + cls.warehouse1 = cls.env["stock.warehouse"].create( |
21 | 22 | {
|
22 | 23 | "name": "Test Warehouse #2",
|
23 | 24 | "code": "TWH-2",
|
24 | 25 | }
|
25 | 26 | )
|
26 |
| - self.local_delivery.write({"so_warehouse_id": self.warehouse0.id}) |
27 |
| - self.poste_delivery.write({"so_warehouse_id": self.warehouse1.id}) |
28 |
| - self.saleperson_warehouse = self.env.user._get_default_warehouse_id() |
| 27 | + cls.local_delivery.write({"so_warehouse_id": cls.warehouse0.id}) |
| 28 | + cls.poste_delivery.write({"so_warehouse_id": cls.warehouse1.id}) |
| 29 | + cls.saleperson_warehouse = cls.env.user._get_default_warehouse_id() |
29 | 30 |
|
30 | 31 | form = Form(
|
31 |
| - self.env["sale.order"], |
| 32 | + cls.env["sale.order"], |
32 | 33 | )
|
33 |
| - form.partner_id = self.env.ref("base.res_partner_2", raise_if_not_found=False) |
| 34 | + form.partner_id = cls.env.ref("base.res_partner_2", raise_if_not_found=False) |
34 | 35 | with form.order_line.new() as line:
|
35 |
| - line.product_id = self.env.ref( |
| 36 | + line.product_id = cls.env.ref( |
36 | 37 | "product.product_product_25", raise_if_not_found=False
|
37 | 38 | )
|
38 |
| - self.sale_order = form.save() |
| 39 | + cls.sale_order = form.save() |
39 | 40 |
|
40 | 41 | def _set_shipping_method(self, delivery_method):
|
41 | 42 | form = Form(
|
|
0 commit comments