I want to change the core calculation of voucher

offers/benefits.py


class PercentageDiscountBenefit(Benefit):
    ....
    ....
    

   def apply(self, basket, condition, offer, discount_percent=None,
              max_total_discount=None):

         if discount_percent is None:
            discount_percent = self.value

        discount_amount_available = max_total_discount

        line_tuples = self.get_applicable_lines(offer, basket)

        discount = D('0.00')
        affected_items = 0
        max_affected_items = self._effective_max_affected_items()
        affected_lines = []
        for price, line in line_tuples:
            if affected_items >= max_affected_items:
                break
            if discount_amount_available == 0:
                break

            quantity_affected = min(line.quantity_without_discount,
                                    max_affected_items - affected_items)
            *line_discount = self.round(discount_percent / D('100.0') * price * 
int(quantity_affected)) * my_var*

            if discount_amount_available is not None:
                line_discount = min(line_discount, discount_amount_available)
                discount_amount_available -= line_discount

            apply_discount(line, line_discount, quantity_affected)

            affected_lines.append((line, line_discount, quantity_affected))
            affected_items += quantity_affected
            discount += line_discount

        if discount > 0:
            condition.consume_items(offer, basket, affected_lines)
        return results.BasketDiscount(discount)

*i want to change line_discount*



-- 
https://github.com/django-oscar/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
--- 
You received this message because you are subscribed to the Google Groups 
"django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-oscar+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-oscar.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/django-oscar/4df2cbf6-e269-4981-8068-bce3a3e833b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to