#NEWLINE# def set_status( self , new_status ) : #NEWLINE# #INDENT# '\n        Set a new status for this order.\n\n        If the requested status is not valid, then ``InvalidOrderStatus`` is\n        raised.\n        ' #NEWLINE# if ( new_status == self . status ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if ( new_status not in self . available_statuses ( ) ) : #NEWLINE# #INDENT# raise exceptions . InvalidOrderStatus ( ( _ ( "'%(new_status)s' is not a valid status for order %(number)s (current status: '%(status)s')" ) % { #NEWLINE# #INDENT# 'new_status' : self , #NEWLINE# 'number' : self . number , #NEWLINE# 'status' : self . status , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# #UNINDENT# self . status = new_status #NEWLINE# if ( new_status in self . cascade ) : #NEWLINE# #INDENT# for line in self . lines . all ( ) : #NEWLINE# #INDENT# line . status = self . cascade [ self . status ] #NEWLINE# line . save ( ) #NEWLINE# #UNINDENT# #UNINDENT# self . save ( )