@@ -11,10 +11,11 @@ def _update_fix_price(self, vals):
11
11
if "list_price" in vals :
12
12
self .mapped ("product_variant_ids" ).write ({"fix_price" : vals ["list_price" ]})
13
13
14
- @api .model
15
- def create (self , vals ):
16
- product_tmpl = super ().create (vals )
17
- product_tmpl ._update_fix_price (vals )
14
+ @api .model_create_multi
15
+ def create (self , vals_list ):
16
+ product_tmpl = super ().create (vals_list )
17
+ for prod , vals in zip (product_tmpl , vals_list ):
18
+ prod ._update_fix_price (vals )
18
19
return product_tmpl
19
20
20
21
def write (self , vals ):
@@ -34,27 +35,25 @@ def _compute_lst_price(self):
34
35
uom_model = self .env ["uom.uom" ]
35
36
for product in self :
36
37
price = product .fix_price or product .list_price
37
- if "uom" in self .env .context :
38
- price = product .uom_id ._compute_price (
39
- price , uom_model .browse (self .env .context ["uom" ])
40
- )
38
+ if self .env .context .get ("uom" ):
39
+ context_uom = uom_model .browse (self .env .context ["uom" ])
40
+ price = product .uom_id ._compute_price (price , context_uom )
41
41
product .lst_price = price
42
42
43
43
def _compute_list_price (self ):
44
44
uom_model = self .env ["uom.uom" ]
45
45
for product in self :
46
46
price = product .fix_price or product .product_tmpl_id .list_price
47
- if "uom" in self .env .context :
48
- price = product .uom_id ._compute_price (
49
- price , uom_model .browse (self .env .context ["uom" ])
50
- )
47
+ if self .env .context .get ("uom" ):
48
+ context_uom = uom_model .browse (self .env .context ["uom" ])
49
+ price = product .uom_id ._compute_price (price , context_uom )
51
50
product .list_price = price
52
51
53
52
def _inverse_product_lst_price (self ):
54
53
uom_model = self .env ["uom.uom" ]
55
54
for product in self :
56
55
vals = {}
57
- if "uom" in self .env .context :
56
+ if self .env .context . get ( "uom" ) :
58
57
vals ["fix_price" ] = product .uom_id ._compute_price (
59
58
product .lst_price , uom_model .browse (self .env .context ["uom" ])
60
59
)
0 commit comments