Changeset - fd9980efc578
[Not reviewed]
0 2 0
Christopher Neugebauer - 8 years ago 2016-09-15 01:41:50
chrisjrn@gmail.com
Makes sure we only apply unclaimed credit notes when auto-applying credit notes.
2 files changed with 15 insertions and 1 deletions:
0 comments (0 inline, 0 general)
registrasion/controllers/invoice.py
Show inline comments
...
 
@@ -219,3 +219,5 @@ class InvoiceController(ForId, object):
 

	
 
        notes = commerce.CreditNote.objects.filter(invoice__user=invoice.user)
 
        notes = commerce.CreditNote.unclaimed().filter(
 
            invoice__user=invoice.user
 
        )
 
        for note in notes:
registrasion/tests/test_credit_note.py
Show inline comments
...
 
@@ -430 +430,13 @@ class CreditNoteTestCase(TestHelperMixin, RegistrationCartTestCase):
 
        self.assertTrue(invoice.invoice.is_unpaid)
 

	
 
    def test_credit_notes_are_applied_even_if_some_notes_are_claimed(self):
 

	
 
        for i in xrange(10):
 
            # Generate credit note
 
            invoice1 = self._manual_invoice(1)
 
            invoice1.pay("Pay", invoice1.invoice.value)
 
            invoice1.refund()
 

	
 
            # Generate invoice that should be automatically paid
 
            invoice2 = self._manual_invoice(1)
 
            self.assertTrue(invoice2.invoice.is_paid)
0 comments (0 inline, 0 general)