Added ne bill total list filter
This commit is contained in:
parent
18582237bd
commit
598bb39f84
2
TODO.md
2
TODO.md
|
@ -447,3 +447,5 @@ mkhomedir_helper or create ssh homes with bash.rc and such
|
||||||
|
|
||||||
|
|
||||||
# show base and total desglosed
|
# show base and total desglosed
|
||||||
|
|
||||||
|
# CLOSE&DOWNLOAD doesn't redirect to anything, confusing for users
|
||||||
|
|
|
@ -49,8 +49,9 @@ class TotalListFilter(SimpleListFilter):
|
||||||
def lookups(self, request, model_admin):
|
def lookups(self, request, model_admin):
|
||||||
return (
|
return (
|
||||||
('gt', mark_safe("total > 0")),
|
('gt', mark_safe("total > 0")),
|
||||||
('eq', "total = 0"),
|
|
||||||
('lt', mark_safe("total < 0")),
|
('lt', mark_safe("total < 0")),
|
||||||
|
('eq', "total = 0"),
|
||||||
|
('ne', mark_safe("total ≠ 0")),
|
||||||
)
|
)
|
||||||
|
|
||||||
def queryset(self, request, queryset):
|
def queryset(self, request, queryset):
|
||||||
|
@ -60,6 +61,8 @@ class TotalListFilter(SimpleListFilter):
|
||||||
return queryset.filter(approx_total=0)
|
return queryset.filter(approx_total=0)
|
||||||
elif self.value() == 'lt':
|
elif self.value() == 'lt':
|
||||||
return queryset.filter(approx_total__lt=0)
|
return queryset.filter(approx_total__lt=0)
|
||||||
|
elif self.value() == 'ne':
|
||||||
|
return queryset.exclude(approx_total=0)
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,9 @@ class BillsBackend(object):
|
||||||
bill = ProForma.objects.create(account=account)
|
bill = ProForma.objects.create(account=account)
|
||||||
else:
|
else:
|
||||||
bill = ProForma.objects.filter(account=account, is_open=True).last()
|
bill = ProForma.objects.filter(account=account, is_open=True).last()
|
||||||
if not bill:
|
if bill:
|
||||||
|
bill.updated()
|
||||||
|
else:
|
||||||
bill = ProForma.objects.create(account=account, is_open=True)
|
bill = ProForma.objects.create(account=account, is_open=True)
|
||||||
bills.append(bill)
|
bills.append(bill)
|
||||||
else:
|
else:
|
||||||
|
@ -37,7 +39,9 @@ class BillsBackend(object):
|
||||||
bill = Invoice.objects.create(account=account)
|
bill = Invoice.objects.create(account=account)
|
||||||
else:
|
else:
|
||||||
bill = Invoice.objects.filter(account=account, is_open=True).last()
|
bill = Invoice.objects.filter(account=account, is_open=True).last()
|
||||||
if not bill:
|
if bill:
|
||||||
|
bill.updated()
|
||||||
|
else:
|
||||||
bill = Invoice.objects.create(account=account, is_open=True)
|
bill = Invoice.objects.create(account=account, is_open=True)
|
||||||
bills.append(bill)
|
bills.append(bill)
|
||||||
else:
|
else:
|
||||||
|
@ -58,7 +62,6 @@ class BillsBackend(object):
|
||||||
order_billed_until=line.order.old_billed_until
|
order_billed_until=line.order.old_billed_until
|
||||||
)
|
)
|
||||||
self.create_sublines(billine, line.discounts)
|
self.create_sublines(billine, line.discounts)
|
||||||
bill.updated()
|
|
||||||
return bills
|
return bills
|
||||||
|
|
||||||
# def format_period(self, ini, end):
|
# def format_period(self, ini, end):
|
||||||
|
|
Loading…
Reference in a new issue