Skip to content

Commit

Permalink
Add is_member_adctive to InvoiceAdmin
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsierro committed Apr 21, 2024
1 parent 4eb83b9 commit 09dd08e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion invoicing/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def send_by_email(self, request, queryset):
if successfully_sent_count > 0:
self.message_user(request, f'{successfully_sent_count} invoices sent by email', messages.SUCCESS)

list_display = ['invoice_actions', 'invoice_number', 'is_sent', 'is_paid', 'member', 'date_invoice', 'date_paid',

list_display = ['invoice_actions', 'invoice_number', 'is_sent', 'is_paid', 'is_member_active', 'member', 'date_invoice', 'date_paid',
'amount_due', 'status', 'comments']
list_display_links = ['invoice_number', ]
readonly_fields = ['invoice_number', 'amount', 'amount_due', 'amount_deduction_machine', 'amount_deduction_cash',
Expand All @@ -86,6 +87,13 @@ def is_sent(self, obj):
def is_paid(self, obj):
return obj.is_paid

@admin.display(boolean=True)
def is_member_active(self, obj):
if obj.member is not None:
return not obj.member.is_resigned
return False


def get_search_results(self, request, queryset, search_term):
queryset, use_distinct = super().get_search_results(request, queryset, search_term)
try:
Expand Down

0 comments on commit 09dd08e

Please sign in to comment.