#NEWLINE# @ transition ( field = state , source = STATES . ISSUED , target = STATES . CANCELED ) #NEWLINE# def cancel( self , cancel_date = None ) : #NEWLINE# #INDENT# if self : #NEWLINE# #INDENT# self . cancel_date = dt . strptime ( cancel_date , '%Y-%m-%d' ) . date ( ) #NEWLINE# #UNINDENT# if ( ( not self . cancel_date ) and ( not cancel_date ) ) : #NEWLINE# #INDENT# self . cancel_date = timezone . now ( ) . date ( ) #NEWLINE# #UNINDENT# self . _save_pdf ( state = self . STATES . CANCELED )