|
@@ -41,16 +41,22 @@ class product_pack(models.Model):
|
|
|
subtotal = fields.Float(
|
|
|
'Subtotal',
|
|
|
required=True,
|
|
|
- default=0.0,
|
|
|
+ compute="_product_price_subtotal"
|
|
|
)
|
|
|
|
|
|
- @api.onchange('product_id')
|
|
|
- def get_price(self):
|
|
|
- self.price = self.product_id.standard_price
|
|
|
- self.subtotal = self.price * self.quantity
|
|
|
+ # @api.onchange('product_id')
|
|
|
+ # def get_price(self):
|
|
|
+ # self.price = self.product_id.lst_price
|
|
|
+ # self.subtotal = self.price * self.quantity
|
|
|
+
|
|
|
+ # @api.onchange('quantity')
|
|
|
+ # def get_subtotal(self):
|
|
|
+ # self.subtotal = self.price * self.quantity
|
|
|
|
|
|
- @api.onchange('quantity')
|
|
|
- def get_subtotal(self):
|
|
|
+ @api.one
|
|
|
+ @api.depends('product_id')
|
|
|
+ def _product_price_subtotal(self):
|
|
|
+ self.price = self.product_id.lst_price
|
|
|
self.subtotal = self.price * self.quantity
|
|
|
|
|
|
@api.multi
|