Adds invoice status to nag_unpaid

This commit is contained in:
Christopher Neugebauer 2017-01-08 09:48:48 +11:00
parent 3b985d40ac
commit de902a213d
2 changed files with 4 additions and 1 deletions

View file

@ -442,6 +442,7 @@ class InvoiceEmailForm(forms.Form):
def __init__(self, *a, **k):
category = k.pop('category', None) or []
product = k.pop('product', None) or []
status = int(k.pop('status', None) or 0)
category = [int(i) for i in category]
product = [int(i) for i in product]
@ -449,7 +450,7 @@ class InvoiceEmailForm(forms.Form):
super(InvoiceEmailForm, self).__init__(*a, **k)
qs = commerce.Invoice.objects.filter(
status=commerce.Invoice.STATUS_UNPAID,
status=status or commerce.Invoice.STATUS_UNPAID,
).filter(
Q(lineitem__product__category__in=category) |
Q(lineitem__product__in=product)

View file

@ -931,11 +931,13 @@ def nag_unpaid(request):
category = request.GET.getlist("category", [])
product = request.GET.getlist("product", [])
status = request.GET.get("status")
form = forms.InvoiceEmailForm(
request.POST or None,
category=category,
product=product,
status=status,
)
emails = []