Пример #1
0
    def get_qty_price(self, qty, show_trial=True, include_discount=True):
        """
        If QTY_DISCOUNT prices are specified, then return the appropriate discount price for
        the specified qty.  Otherwise, return the unit_price
        returns price as a Decimal

        Note: If a subscription has a trial, then we'll return the first trial price, otherwise the checkout won't
        balance and it will look like there are items to be paid on the order.
        """
        if show_trial:
            trial = self.get_trial_terms(0)
        else:
            trial = None

        if trial:
            price = trial.price * qty
        else:
            if include_discount:
                price = get_product_quantity_price(self.product, qty)
            else:
                adjustment = get_product_quantity_adjustments(self, qty)
                if adjustment.price is not None:
                    price = adjustment.price.price
                else:
                    price = None

            if not price and qty == Decimal('1'):  # Prevent a recursive loop.
                price = Decimal("0.00")
            elif not price:
                price = self.product._get_fullPrice()
        return price
Пример #2
0
    def get_qty_price(self, qty, show_trial=True, include_discount=True):
        """
        If QTY_DISCOUNT prices are specified, then return the appropriate discount price for
        the specified qty.  Otherwise, return the unit_price
        returns price as a Decimal

        Note: If a subscription has a trial, then we'll return the first trial price, otherwise the checkout won't
        balance and it will look like there are items to be paid on the order.
        """
        if show_trial:
            trial = self.get_trial_terms(0)
        else:
            trial = None

        if trial:
            price = trial.price * qty
        else:
            if include_discount:
                price = get_product_quantity_price(self.product, qty)
            else:
                adjustment = get_product_quantity_adjustments(self, qty)
                if adjustment.price is not None:
                    price = adjustment.price.price
                else:
                    price = None

            if not price and qty == Decimal('1'):      # Prevent a recursive loop.
                price = Decimal("0.00")
            elif not price:
                price = self.product._get_fullPrice()
        return price
Пример #3
0
Файл: models.py Проект: 34/T
    def get_full_price(self, qty=Decimal('1')):
        """
        Return the full price, ignoring the deposit.
        """
        price = get_product_quantity_price(self.product, qty)
        if not price:
            price = self.product.unit_price

        return price
Пример #4
0
    def get_full_price(self, qty=Decimal('1')):
        """
        Return the full price, ignoring the deposit.
        """
        price = get_product_quantity_price(self.product, qty)
        if not price:
            price = self.product.unit_price

        return price
Пример #5
0
Файл: models.py Проект: 34/T
    def get_qty_price(self, qty, include_discount=True):
        """
        If QTY_DISCOUNT prices are specified, then return the appropriate discount price for
        the specified qty.  Otherwise, return the unit_price
        returns price as a Decimal
        """
        if include_discount:
            price = get_product_quantity_price(self.product, qty)
        else:
            adjustment = get_product_quantity_adjustments(self, qty)
            if adjustment.price is not None:
                price = adjustment.price.price
            else:
                price = None

        if not price and qty == Decimal('1'): # Prevent a recursive loop.
            price = Decimal("0.00")
        elif not price:
            price = self.product._get_fullPrice()

        return price * self.downpayment / 100
Пример #6
0
    def get_qty_price(self, qty, include_discount=True):
        """
        If QTY_DISCOUNT prices are specified, then return the appropriate discount price for
        the specified qty.  Otherwise, return the unit_price
        returns price as a Decimal
        """
        if include_discount:
            price = get_product_quantity_price(self.product, qty)
        else:
            adjustment = get_product_quantity_adjustments(self.product, qty)
            if adjustment.price is not None:
                price = adjustment.price.price
            else:
                price = None

        if not price and qty == Decimal('1'): # Prevent a recursive loop.
            price = Decimal("0.00")
        elif not price:
            price = self.product._get_fullPrice()

        return price * self.downpayment / 100