|
@@ -44,19 +44,32 @@ class product_pack(models.Model):
|
|
compute="_product_price_subtotal"
|
|
compute="_product_price_subtotal"
|
|
)
|
|
)
|
|
|
|
|
|
- # @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.one
|
|
@api.one
|
|
@api.depends('product_id')
|
|
@api.depends('product_id')
|
|
def _product_price_subtotal(self):
|
|
def _product_price_subtotal(self):
|
|
- self.price = self.product_id.lst_price
|
|
|
|
|
|
+ if(self.price > 0):
|
|
|
|
+ self.subtotal = self.price * self.quantity
|
|
|
|
+ else:
|
|
|
|
+ self.price = self.product_id.lst_price
|
|
|
|
+
|
|
|
|
+ self.subtotal = self.price * self.quantity
|
|
|
|
+
|
|
|
|
+ @api.onchange('price')
|
|
|
|
+ def _product_change_price_subtotal(self):
|
|
|
|
+ if(self.price > 0):
|
|
|
|
+ self.subtotal = self.price * self.quantity
|
|
|
|
+ else:
|
|
|
|
+ self.price = self.product_id.lst_price
|
|
|
|
+
|
|
|
|
+ self.subtotal = self.price * self.quantity
|
|
|
|
+
|
|
|
|
+ @api.onchange('quantity')
|
|
|
|
+ def _product_change_quantity_subtotal(self):
|
|
|
|
+ if(self.price > 0):
|
|
|
|
+ self.subtotal = self.price * self.quantity
|
|
|
|
+ else:
|
|
|
|
+ self.price = self.product_id.lst_price
|
|
|
|
+
|
|
self.subtotal = self.price * self.quantity
|
|
self.subtotal = self.price * self.quantity
|
|
|
|
|
|
@api.multi
|
|
@api.multi
|