def create_from_item(cls, amount, item_description, **kwargs):
        '''
        Creates an Invoice as well as a single associated InvoiceItem
        with the passed description (for things like gift certificates)
        '''
        submissionUser = kwargs.pop('submissionUser', None)
        collectedByUser = kwargs.pop('collectedByUser', None)
        calculate_taxes = kwargs.pop('calculate_taxes', False)
        grossTotal = kwargs.pop('grossTotal',None)

        new_invoice = cls(
            grossTotal=grossTotal or amount,
            total=amount,
            submissionUser=submissionUser,
            collectedByUser=collectedByUser,
            buyerPaysSalesTax=getConstant('registration__buyerPaysSalesTax'),
            data=kwargs,
        )

        if calculate_taxes:
            new_invoice.calculateTaxes()

        new_invoice.save()

        InvoiceItem.objects.create(
            invoice=new_invoice,
            grossTotal=grossTotal or amount,
            total=amount,
            taxes=new_invoice.taxes,
            description=item_description,
        )
        return new_invoice
def create_from_item ( cls , amount , item_description , ** kwargs ) : submissionUser = kwargs . pop ( 'submissionUser' , None ) collectedByUser = kwargs . pop ( 'collectedByUser' , None ) calculate_taxes = kwargs . pop ( 'calculate_taxes' , False ) grossTotal = kwargs . pop ( 'grossTotal' , None ) new_invoice = cls ( grossTotal = grossTotal or amount , total = amount , submissionUser = submissionUser , collectedByUser = collectedByUser , buyerPaysSalesTax = getConstant ( 'registration__buyerPaysSalesTax' ) , data = kwargs , ) if calculate_taxes : new_invoice . calculateTaxes ( ) new_invoice . save ( ) InvoiceItem . objects . create ( invoice = new_invoice , grossTotal = grossTotal or amount , total = amount , taxes = new_invoice . taxes , description = item_description , ) return new_invoice
Creates an Invoice as well as a single associated InvoiceItem
        with the passed description (for things like gift certificates)