In theory all subscriptions should have a primary member, but in some corner cases it may happen that they don't. This then needs to be fixed manually. Billing pages should not fail in this case.
Related Traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, *callback_kwargs)
File "/usr/local/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
return view_func(request, args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/juntagrico_billing/views.py", line 98, in pending_bills
pending_bills = [
File "/usr/local/lib/python3.9/site-packages/juntagrico_billing/views.py", line 104, in
get_existing_bills(member, selected_year)
File "/usr/local/lib/python3.9/site-packages/juntagrico_billing/views.py", line 151, in get_existing_bills
bills = member.bills.filter(business_year=year)
Exception Type: AttributeError at /jb/pending_bills
Exception Value: 'NoneType' object has no attribute 'bills'
Currently the "pending bills" page and possibly others fail to load, if there is a subscription without primary member.
This function should be made more robust for the case of subscriptions without primary member. e.g. it should return None or an empty list if member is None: https://github.com/juntagrico/juntagrico-billing/blob/536e9cbfc7dab0c474cab6a8035c575cc10bbe18/juntagrico_billing/views.py#L150C1-L152
In theory all subscriptions should have a primary member, but in some corner cases it may happen that they don't. This then needs to be fixed manually. Billing pages should not fail in this case.
Related Traceback: