You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829
  1. from oscar.apps.checkout import session
  2. from apps import tax
  3. # Override the session mixin (which every checkout view uses) so we can apply
  4. # takes when the shipping address is known.
  5. class CheckoutSessionMixin(session.CheckoutSessionMixin):
  6. def build_submission(self, **kwargs):
  7. submission = super(CheckoutSessionMixin, self).build_submission(
  8. **kwargs)
  9. if submission['shipping_address'] and submission['shipping_method']:
  10. tax.apply_to(submission)
  11. # Recalculate order total to ensure we have a tax-inclusive total
  12. submission['order_total'] = self.get_order_totals(
  13. submission['basket'], submission['shipping_charge'])
  14. return submission
  15. def get_context_data(self, **kwargs):
  16. ctx = super(CheckoutSessionMixin, self).get_context_data(**kwargs)
  17. # Oscar's checkout templates look for this variable which specifies to
  18. # break out the tax totals into a separate subtotal.
  19. ctx['show_tax_separately'] = True
  20. return ctx