def get_qty_price(self, qty, include_discount=True): if include_discount: price = get_product_quantity_price( self.product, qty, delta=self.price_delta(False), parent=self.parent.product) else: adjustment = get_product_quantity_adjustments(self, qty, parent=self.parent.product) if adjustment.price is not None: price = adjustment.price.price + self.price_delta(True) else: price = None return price
def get_qty_price(self, qty, include_discount=True): # if no prices have been set specifically for this variation, we derive a price from the parent # if a price *has* been set (for the appropriate quantity), the delta is ignored, and the price is used as-is should_use_delta = len(self._get_self_qty_price_list(qty)) == 0 if include_discount: price = get_product_quantity_price( self.product, qty, delta=(0, self.price_delta(False))[should_use_delta], parent=self.parent.product) else: adjustment = get_product_quantity_adjustments(self.product, qty, parent=self.parent.product) if adjustment.price is not None: price = adjustment.price.price + self.price_delta(True) else: price = None return price
def get_qty_price(self, qty, include_discount=True): # if no prices have been set specifically for this variation, we derive a price from the parent # if a price *has* been set (for the appropriate quantity), the delta is ignored, and the price is used as-is should_use_delta = len(self._get_self_qty_price_list(qty)) == 0 if include_discount: price = get_product_quantity_price( self.product, qty, delta=(0, self.price_delta(False))[should_use_delta], parent=self.parent.product) else: adjustment = get_product_quantity_adjustments(self, qty, parent=self.parent.product) if adjustment.price is not None: price = adjustment.price.price + self.price_delta(True) else: price = None return price