5
5
6
6
7
7
class TestStockQuantPackageDimension (common .SavepointCase ):
8
-
9
8
@classmethod
10
9
def setUpClass (cls ):
11
10
super ().setUpClass ()
12
- cls .foot = cls .env .ref ('uom.product_uom_foot' )
13
- cls .meter = cls .env .ref ('uom.product_uom_meter' )
11
+ cls .foot = cls .env .ref ("uom.product_uom_foot" )
12
+ cls .meter = cls .env .ref ("uom.product_uom_meter" )
13
+ cls .inch = cls .env .ref ("uom.product_uom_inch" )
14
+ cls .cm = cls .env .ref ("uom.product_uom_cm" )
14
15
cls .height = 0.38
15
16
cls .packaging_length = 0.80
16
17
cls .width = 3.77
17
18
18
19
def test_stock_quant_dimension_with_decimal (self ):
19
- self .stock_quant_package = self .env ['stock.quant.package' ].create ({
20
- 'name' : 'Test stock quant package' ,
21
- 'height' : self .height ,
22
- 'packaging_length' : self .packaging_length ,
23
- 'width' : self .width ,
24
- })
20
+ self .stock_quant_package = self .env ["stock.quant.package" ].create (
21
+ {
22
+ "name" : "Test stock quant package" ,
23
+ "height" : self .height ,
24
+ "packaging_length" : self .packaging_length ,
25
+ "width" : self .width ,
26
+ }
27
+ )
25
28
26
29
self .stock_quant_package .refresh ()
27
30
28
31
self .assertEqual (self .stock_quant_package .height , self .height )
29
32
self .assertEqual (
30
- self .stock_quant_package .packaging_length , self .packaging_length )
33
+ self .stock_quant_package .packaging_length , self .packaging_length
34
+ )
31
35
self .assertEqual (self .stock_quant_package .width , self .width )
32
36
33
37
def test_stock_quant_package_dimension_uom (self ):
34
- self .stock_quant_package_ft = self .env ['stock.quant.package' ].create ({
35
- 'name' : 'Test stock quant package - foot' ,
36
- 'height' : self .height ,
37
- 'height_uom_id' : self .foot .id ,
38
- 'packaging_length' : self .packaging_length ,
39
- 'length_uom_id' : self .foot .id ,
40
- 'width' : self .width ,
41
- 'width_uom_id' : self .foot .id ,
42
- })
43
-
44
- self .stock_quant_package_m = self .env ['stock.quant.package' ].create ({
45
- 'name' : 'Test stock quant package - meter' ,
46
- 'height' : self .height ,
47
- 'height_uom_id' : self .meter .id ,
48
- 'packaging_length' : self .packaging_length ,
49
- 'length_uom_id' : self .meter .id ,
50
- 'width' : self .width ,
51
- 'width_uom_id' : self .meter .id ,
52
- })
38
+ self .stock_quant_package_ft = self .env ["stock.quant.package" ].create (
39
+ {
40
+ "name" : "Test stock quant package - foot" ,
41
+ "height" : self .height ,
42
+ "height_uom_id" : self .foot .id ,
43
+ "packaging_length" : self .packaging_length ,
44
+ "length_uom_id" : self .foot .id ,
45
+ "width" : self .width ,
46
+ "width_uom_id" : self .foot .id ,
47
+ }
48
+ )
49
+
50
+ self .stock_quant_package_m = self .env ["stock.quant.package" ].create (
51
+ {
52
+ "name" : "Test stock quant package - meter" ,
53
+ "height" : self .height ,
54
+ "height_uom_id" : self .meter .id ,
55
+ "packaging_length" : self .packaging_length ,
56
+ "length_uom_id" : self .meter .id ,
57
+ "width" : self .width ,
58
+ "width_uom_id" : self .meter .id ,
59
+ }
60
+ )
61
+
62
+ self .stock_quant_package_inch = self .env ["stock.quant.package" ].create (
63
+ {
64
+ "name" : "Test stock quant package - inch" ,
65
+ "height" : self .height ,
66
+ "height_uom_id" : self .inch .id ,
67
+ "packaging_length" : self .packaging_length ,
68
+ "length_uom_id" : self .inch .id ,
69
+ "width" : self .width ,
70
+ "width_uom_id" : self .inch .id ,
71
+ }
72
+ )
73
+
74
+ self .stock_quant_package_cm = self .env ["stock.quant.package" ].create (
75
+ {
76
+ "name" : "Test stock quant package - cm" ,
77
+ "height" : self .height ,
78
+ "height_uom_id" : self .cm .id ,
79
+ "packaging_length" : self .packaging_length ,
80
+ "length_uom_id" : self .cm .id ,
81
+ "width" : self .width ,
82
+ "width_uom_id" : self .cm .id ,
83
+ }
84
+ )
53
85
54
86
self .stock_quant_package_ft .refresh ()
55
87
self .stock_quant_package_m .refresh ()
@@ -60,3 +92,12 @@ def test_stock_quant_package_dimension_uom(self):
60
92
self .assertEqual (self .stock_quant_package_m .height_uom_id , self .meter )
61
93
self .assertEqual (self .stock_quant_package_m .length_uom_id , self .meter )
62
94
self .assertEqual (self .stock_quant_package_m .width_uom_id , self .meter )
95
+ self .assertEqual (
96
+ self .stock_quant_package_inch .height_uom_id , self .inch )
97
+ self .assertEqual (
98
+ self .stock_quant_package_inch .length_uom_id , self .inch )
99
+ self .assertEqual (
100
+ self .stock_quant_package_inch .width_uom_id , self .inch )
101
+ self .assertEqual (self .stock_quant_package_cm .height_uom_id , self .cm )
102
+ self .assertEqual (self .stock_quant_package_cm .length_uom_id , self .cm )
103
+ self .assertEqual (self .stock_quant_package_cm .width_uom_id , self .cm )
0 commit comments