Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

calculators.py 893B

123456789101112131415161718192021222324
  1. from oscar.core import prices
  2. class OrderTotalCalculator(object):
  3. """
  4. Calculator class for calculating the order total.
  5. """
  6. def __init__(self, request=None):
  7. # We store a reference to the request as the total may
  8. # depend on the user or the other checkout data in the session.
  9. # Further, it is very likely that it will as shipping method
  10. # always changes the order total.
  11. self.request = request
  12. def calculate(self, basket, shipping_method, **kwargs):
  13. excl_tax = basket.total_excl_tax + shipping_method.charge_excl_tax
  14. if basket.is_tax_known and shipping_method.is_tax_known:
  15. incl_tax = basket.total_incl_tax + shipping_method.charge_incl_tax
  16. else:
  17. incl_tax = None
  18. return prices.Price(
  19. currency=basket.currency,
  20. excl_tax=excl_tax, incl_tax=incl_tax)