@@ -27,6 +27,7 @@ class DeliveryRoulierCase(TransactionCase):
27
27
@classmethod
28
28
def setUpClass (cls ):
29
29
super ().setUpClass ()
30
+ cls .env = cls .env (context = dict (cls .env .context , tracking_disable = True ))
30
31
cls .loader = FakeModelLoader (cls .env , cls .__module__ )
31
32
cls .loader .backup_registry ()
32
33
@@ -35,32 +36,29 @@ def setUpClass(cls):
35
36
36
37
cls .loader .update_registry ((FakeDeliveryCarrier ,))
37
38
cls .real_get_carriers_action_available = roulier .get_carriers_action_available
38
-
39
- def setUp (self ):
40
- super ().setUp ()
41
- delivery_product = self .env ["product.product" ].create (
39
+ delivery_product = cls .env ["product.product" ].create (
42
40
{"name" : "test shipping product" , "type" : "service" }
43
41
)
44
- self .account = self .env ["carrier.account" ].create (
42
+ cls .account = cls .env ["carrier.account" ].create (
45
43
{
46
44
"name" : "Test Carrier Account" ,
47
45
"delivery_type" : "test" ,
48
46
"account" : "test" ,
49
47
"password" : "test" ,
50
48
}
51
49
)
52
- self .test_carrier = self .env ["delivery.carrier" ].create (
50
+ cls .test_carrier = cls .env ["delivery.carrier" ].create (
53
51
{
54
52
"name" : "Test Carrier" ,
55
53
"delivery_type" : "test" ,
56
54
"product_id" : delivery_product .id ,
57
- "carrier_account_id" : self .account .id ,
55
+ "carrier_account_id" : cls .account .id ,
58
56
}
59
57
)
60
- partner = self .env ["res.partner" ].create (
58
+ partner = cls .env ["res.partner" ].create (
61
59
{
62
60
"name" : "Carrier label test customer" ,
63
- "country_id" : self .env .ref ("base.fr" ).id ,
61
+ "country_id" : cls .env .ref ("base.fr" ).id ,
64
62
"street" : "test street" ,
65
63
"street2" : "test street2" ,
66
64
"city" : "test city" ,
@@ -69,27 +67,27 @@ def setUp(self):
69
67
"zip" : "00000" ,
70
68
}
71
69
)
72
- product = self .env ["product.product" ].create (
70
+ product = cls .env ["product.product" ].create (
73
71
{"name" : "Carrier test product" , "type" : "product" , "weight" : 1.2 }
74
72
)
75
- self .order = self .env ["sale.order" ].create (
73
+ cls .order = cls .env ["sale.order" ].create (
76
74
{
77
- "carrier_id" : self .test_carrier .id ,
75
+ "carrier_id" : cls .test_carrier .id ,
78
76
"partner_id" : partner .id ,
79
77
"order_line" : [
80
78
(0 , 0 , {"product_id" : product .id , "product_uom_qty" : 1 })
81
79
],
82
80
}
83
81
)
84
- self .env ["stock.quant" ].with_context (inventory_mode = True ).create (
82
+ cls .env ["stock.quant" ].with_context (inventory_mode = True ).create (
85
83
{
86
84
"product_id" : product .id ,
87
- "location_id" : self .order .warehouse_id .lot_stock_id .id ,
85
+ "location_id" : cls .order .warehouse_id .lot_stock_id .id ,
88
86
"inventory_quantity" : 1 ,
89
87
}
90
88
).action_apply_inventory ()
91
- self .order .action_confirm ()
92
- self .picking = self .order .picking_ids
89
+ cls .order .action_confirm ()
90
+ cls .picking = cls .order .picking_ids
93
91
94
92
@classmethod
95
93
def tearDownClass (cls ):
0 commit comments