adds invoice_recipient to AttendeeProfileBase
This commit is contained in:
parent
38cdb8aa63
commit
0e80e0336c
2 changed files with 18 additions and 1 deletions
|
@ -73,6 +73,11 @@ class InvoiceController(object):
|
||||||
# Never generate a due time that is before the issue time
|
# Never generate a due time that is before the issue time
|
||||||
due = max(issued, reservation_limit)
|
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(
|
invoice = rego.Invoice.objects.create(
|
||||||
user=cart.user,
|
user=cart.user,
|
||||||
cart=cart,
|
cart=cart,
|
||||||
|
@ -81,7 +86,7 @@ class InvoiceController(object):
|
||||||
value=Decimal(),
|
value=Decimal(),
|
||||||
issue_time=issued,
|
issue_time=issued,
|
||||||
due_time=due,
|
due_time=due,
|
||||||
recipient="BOB_THOMAS", # TODO: add recipient generating code
|
recipient=recipient,
|
||||||
)
|
)
|
||||||
|
|
||||||
product_items = rego.ProductItem.objects.filter(cart=cart)
|
product_items = rego.ProductItem.objects.filter(cart=cart)
|
||||||
|
|
|
@ -23,6 +23,9 @@ class RegistrationCartTestCase(SetTimeMixin, TestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
|
|
||||||
|
super(RegistrationCartTestCase, cls).setUpTestData()
|
||||||
|
|
||||||
cls.USER_1 = User.objects.create_user(
|
cls.USER_1 = User.objects.create_user(
|
||||||
username='testuser',
|
username='testuser',
|
||||||
email='test@example.com',
|
email='test@example.com',
|
||||||
|
@ -33,6 +36,15 @@ class RegistrationCartTestCase(SetTimeMixin, TestCase):
|
||||||
email='test2@example.com',
|
email='test2@example.com',
|
||||||
password='top_secret')
|
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.RESERVATION = datetime.timedelta(hours=1)
|
||||||
|
|
||||||
cls.categories = []
|
cls.categories = []
|
||||||
|
|
Loading…
Reference in a new issue