diff --git a/invoicing/admin.py b/invoicing/admin.py index 03a9993..6ca9b78 100644 --- a/invoicing/admin.py +++ b/invoicing/admin.py @@ -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', @@ -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: