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
|
||||
|
||||
# CLOSE&DOWNLOAD doesn't redirect to anything, confusing for users
|
||||
|
|
|
@ -49,8 +49,9 @@ class TotalListFilter(SimpleListFilter):
|
|||
def lookups(self, request, model_admin):
|
||||
return (
|
||||
('gt', mark_safe("total > 0")),
|
||||
('eq', "total = 0"),
|
||||
('lt', mark_safe("total < 0")),
|
||||
('eq', "total = 0"),
|
||||
('ne', mark_safe("total ≠ 0")),
|
||||
)
|
||||
|
||||
def queryset(self, request, queryset):
|
||||
|
@ -60,6 +61,8 @@ class TotalListFilter(SimpleListFilter):
|
|||
return queryset.filter(approx_total=0)
|
||||
elif self.value() == 'lt':
|
||||
return queryset.filter(approx_total__lt=0)
|
||||
elif self.value() == 'ne':
|
||||
return queryset.exclude(approx_total=0)
|
||||
return queryset
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,9 @@ class BillsBackend(object):
|
|||
bill = ProForma.objects.create(account=account)
|
||||
else:
|
||||
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)
|
||||
bills.append(bill)
|
||||
else:
|
||||
|
@ -37,7 +39,9 @@ class BillsBackend(object):
|
|||
bill = Invoice.objects.create(account=account)
|
||||
else:
|
||||
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)
|
||||
bills.append(bill)
|
||||
else:
|
||||
|
@ -58,7 +62,6 @@ class BillsBackend(object):
|
|||
order_billed_until=line.order.old_billed_until
|
||||
)
|
||||
self.create_sublines(billine, line.discounts)
|
||||
bill.updated()
|
||||
return bills
|
||||
|
||||
# def format_period(self, ini, end):
|
||||
|
|
Loading…
Reference in a new issue