@treeio_login_required
@handle_response_format
def order_delete(request, order_id, response_format='html'):
 order = get_object_or_404(SaleOrder, pk=order_id)
 if ((not request.user.profile.has_permission(order, mode='w')) and (not request.user.profile.is_admin('treeio.sales'))):
  return user_denied(request, "You don't have access to this Sale Status", response_format)
 if request.POST:
  if ('delete' in request.POST):
   if ('trash' in request.POST):
    order.trash = True
    order.save()
   else:
    order.delete()
   return HttpResponseRedirect(reverse('sales_index'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('sales_order_view', args=[order.id]))
 all_orders = Object.filter_by_request(request, SaleOrder.objects)
 return render_to_response('sales/order_delete', {'order': order, 'orders': all_orders}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def order_delete ( request , order_id , response_format = 'html' ) : order = get_object_or_404 ( SaleOrder , pk = order_id ) if ( ( not request . user . profile . has_permission ( order , mode = 'w' ) ) and ( not request . user . profile . is_admin ( 'treeio.sales' ) ) ) : return user_denied ( request , "You don't have access to this Sale Status" , response_format ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : order . trash = True order . save ( ) else : order . delete ( ) return HttpResponseRedirect ( reverse ( 'sales_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'sales_order_view' , args = [ order . id ] ) ) all_orders = Object . filter_by_request ( request , SaleOrder . objects ) return render_to_response ( 'sales/order_delete' , { 'order' : order , 'orders' : all_orders } , context_instance = RequestContext ( request ) , response_format = response_format )
saleorder delete .