#NEWLINE# def payment_event_quantity( self , event_type ) : #NEWLINE# #INDENT# '\n        Return the quantity of this line that has been involved in a payment\n        event of the passed type.\n        ' #NEWLINE# result = self . payment_event_quantities . filter ( event__event_type = event_type ) . aggregate ( Sum ( 'quantity' ) ) #NEWLINE# if ( event_type [ 'quantity__sum' ] is None ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return result [ 'quantity__sum' ]