adds invoice_recipient to AttendeeProfileBase

This commit is contained in:
Christopher Neugebauer 2016-04-07 16:59:03 +10:00
parent 38cdb8aa63
commit 0e80e0336c
2 changed files with 18 additions and 1 deletions

View file

@ -73,6 +73,11 @@ class InvoiceController(object):
# Never generate a due time that is before the issue time
due = max(issued, reservation_limit)
# Get the invoice recipient
profile = rego.AttendeeProfileBase.objects.get_subclass(
id=cart.user.attendee.attendeeprofilebase.id,
)
recipient = profile.invoice_recipient()
invoice = rego.Invoice.objects.create(
user=cart.user,
cart=cart,
@ -81,7 +86,7 @@ class InvoiceController(object):
value=Decimal(),
issue_time=issued,
due_time=due,
recipient="BOB_THOMAS", # TODO: add recipient generating code
recipient=recipient,
)
product_items = rego.ProductItem.objects.filter(cart=cart)

View file

@ -23,6 +23,9 @@ class RegistrationCartTestCase(SetTimeMixin, TestCase):
@classmethod
def setUpTestData(cls):
super(RegistrationCartTestCase, cls).setUpTestData()
cls.USER_1 = User.objects.create_user(
username='testuser',
email='test@example.com',
@ -33,6 +36,15 @@ class RegistrationCartTestCase(SetTimeMixin, TestCase):
email='test2@example.com',
password='top_secret')
attendee1 = rego.Attendee.get_instance(cls.USER_1)
attendee1.save()
profile1 = rego.AttendeeProfileBase.objects.create(attendee=attendee1)
profile1.save()
attendee2 = rego.Attendee.get_instance(cls.USER_2)
attendee2.save()
profile2 = rego.AttendeeProfileBase.objects.create(attendee=attendee2)
profile2.save()
cls.RESERVATION = datetime.timedelta(hours=1)
cls.categories = []