#NEWLINE# def clean( self ) : #NEWLINE# #INDENT# super ( BillingDocument , self ) . clean ( ) #NEWLINE# if ( ( self . _last_state == self . STATES . ISSUED ) and ( self . state not in [ self . STATES . PAID , self . STATES . CANCELED ] ) ) : #NEWLINE# #INDENT# msg = 'You cannot edit the document once it is in issued state.' #NEWLINE# raise ValidationError ( { #NEWLINE# #INDENT# NON_FIELD_ERRORS : msg , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if ( self . _last_state == self . STATES . CANCELED ) : #NEWLINE# #INDENT# msg = 'You cannot edit the document once it is in canceled state.' #NEWLINE# raise ValidationError ( { #NEWLINE# #INDENT# NON_FIELD_ERRORS : msg , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if ( self . _last_state == self . STATES . PAID ) : #NEWLINE# #INDENT# msg = 'You cannot edit the document once it is in paid state.' #NEWLINE# raise ValidationError ( { #NEWLINE# #INDENT# NON_FIELD_ERRORS : msg , #NEWLINE# #UNINDENT# } )