@treeio_login_required
@handle_response_format
def order_view(request, order_id, response_format='html'):
 profile = request.user.profile
 order = get_object_or_404(SaleOrder, pk=order_id)
 form = _do_update_record(profile, request, order)
 if form.is_valid():
  record = form.save()
  record.set_user_from_request(request)
  order = record.object
 if ((not profile.has_permission(order)) and (not profile.is_admin('treeio.sales'))):
  return user_denied(request, message="You don't have access to this Sale")
 ordered_products = order.orderedproduct_set.filter(trash=False)
 return render_to_response('sales/order_view', {'order': order, 'ordered_products': ordered_products, 'record_form': form}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def order_view ( request , order_id , response_format = 'html' ) : profile = request . user . profile order = get_object_or_404 ( SaleOrder , pk = order_id ) form = _do_update_record ( profile , request , order ) if form . is_valid ( ) : record = form . save ( ) record . set_user_from_request ( request ) order = record . object if ( ( not profile . has_permission ( order ) ) and ( not profile . is_admin ( 'treeio.sales' ) ) ) : return user_denied ( request , message = "You don't have access to this Sale" ) ordered_products = order . orderedproduct_set . filter ( trash = False ) return render_to_response ( 'sales/order_view' , { 'order' : order , 'ordered_products' : ordered_products , 'record_form' : form } , context_instance = RequestContext ( request ) , response_format = response_format )
saleorder view .