a guest Dec 16th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- def handle_order_status_change(self, order, new_status, note_msg=None):
- # First we need to update each order line statuses before continuing on the order
- for line in order.lines.all():
- self.handle_line_status_change(order, line, new_status)
- commtype = None
- if new_status == 'Shipping': # send an email to the customer that says your item is one its way.
- commtype = "ORDER_SHIPPING"
- elif new_status == 'Delivered':
- if order.lines.filter(product__product_class__is_digital=True).exists():
- commtype = "ORDER_DELIVERED_DIGITAL"
- commtype = "ORDER_DELIVERED"
- elif new_status == 'Cancelled':
- commtype = "ORDER_CANCELLED"
- elif new_status == 'Refund requested':
- commtype = "ORDER_REFUND_REQUESTED"
- elif new_status == 'Refunded':
- commtype = "ORDER_REFUNDED"
- super().handle_order_status_change(order, new_status, note_msg) #updating of order happens here.
- if commtype:
- self.send_confirmation_message(order, commtype)
RAW Paste Data