File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -159,3 +159,19 @@ def _compute_show_weight_uom_warning(self):
159
159
)
160
160
for template in self - unique_variants :
161
161
template .show_weight_uom_warning = False
162
+
163
+ def _prepare_variant_values (self , combination ):
164
+ res = super ()._prepare_variant_values (combination )
165
+ if self .product_volume :
166
+ res .update (
167
+ {
168
+ "product_volume" : self .product_volume ,
169
+ }
170
+ )
171
+ if self .product_weight :
172
+ res .update (
173
+ {
174
+ "product_weight" : self .product_weight ,
175
+ }
176
+ )
177
+ return res
Original file line number Diff line number Diff line change @@ -111,3 +111,14 @@ def test_template_with_variant(self):
111
111
self .assertEqual (template .weight , 10.0 )
112
112
self .assertEqual (template .product_volume , 10.0 )
113
113
self .assertEqual (template .product_weight , 10.0 )
114
+
115
+ def test_template_create (self ):
116
+ template = self .env ["product.template" ].create (
117
+ {
118
+ "name" : "Template" ,
119
+ "product_volume" : 10 ,
120
+ "product_weight" : 10 ,
121
+ }
122
+ )
123
+ self .assertEqual (template .product_volume , 10 )
124
+ self .assertEqual (template .product_weight , 10 )
You can’t perform that action at this time.
0 commit comments