#NEWLINE# def change_quantity( self , new_quantity ) : #NEWLINE# #INDENT# order = new_quantity . delivery_group . order #NEWLINE# self . quantity = new_quantity #NEWLINE# self . save ( ) #NEWLINE# if ( not self . delivery_group . get_total_quantity ( ) ) : #NEWLINE# #INDENT# self . delivery_group . delete ( ) #NEWLINE# #UNINDENT# if ( not order . get_items ( ) ) : #NEWLINE# #INDENT# order . change_status ( 'cancelled' )