I want to add "Return Product" after "Product Delivery" functionality in 
Django Oscar. in settings.pyi added below code

OSCAR_ORDER_STATUS_PIPELINE = {
'Pending': ('Processing', 'Cancelled',),
'Processing': ('Shipped', 'Cancelled',),
'Shipped': ('Delivered', 'Return', 'Returned', 'Cancelled',),
'Returned': ('Return', 'Returned',),
'Delivered': (),
'Cancelled': (),
}

OSCAR_ORDER_STATUS_CASCADE = {
  'Processing': 'In progress',
  'Shipped': 'Shipped',
  'Delivered': 'Delivered',
  'Returned': 'Returned',
 'Cancelled': 'Cancelled'
}


i have written Ajax function to change the status after Order gets 
"Delivered" to "Return". below is the function.

@csrf_exempt
def return_order(request):
# Return Order after Delivery
  if request.is_ajax():
    data = request.body.decode('utf-8')
    try:
        order = Order.objects.get(id=int(data))
        EventHandler().handle_order_status_change(order=order, 
new_status='Return')
        return HttpResponse(json.dumps({'status': 'True', 'msg': 'OK'}))
    except Exception as e:
        print(e)
        return HttpResponse(json.dumps({'status': 'False', 'msg': 'Error'}))


I am geting Error something like this

'Return' is not a valid status for order 100213 (current status: 'Delivered'
)


-- 
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/bff4e012-3a8e-44aa-9893-b4ebddbc1993%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to