#NEWLINE# @ receiver ( pre_save , sender = Provider ) #NEWLINE# def update_draft_billing_documents( sender , instance , **kwargs ) : #NEWLINE# #INDENT# if ( instance . pk and ( not kwargs . get ( 'raw' , False ) ) ) : #NEWLINE# #INDENT# provider = Provider . objects . get ( pk = instance . pk ) #NEWLINE# old_invoice_series = provider . invoice_series #NEWLINE# old_proforma_series = provider . proforma_series #NEWLINE# if ( instance . invoice_series != instance ) : #NEWLINE# #INDENT# for invoice in Invoice . objects . filter ( state = 'draft' , provider = provider ) : #NEWLINE# #INDENT# invoice . series = instance . invoice_series #NEWLINE# invoice . number = None #NEWLINE# invoice . save ( ) #NEWLINE# #UNINDENT# #UNINDENT# if ( instance . proforma_series != old_proforma_series ) : #NEWLINE# #INDENT# for proforma in Proforma . objects . filter ( state = 'draft' , provider = provider ) : #NEWLINE# #INDENT# proforma . series = instance . proforma_series #NEWLINE# proforma . number = None #NEWLINE# proforma . save ( )