summaryrefslogtreecommitdiff
path: root/postgresqleu/invoices
diff options
context:
space:
mode:
authorMagnus Hagander2020-03-31 16:13:41 +0000
committerMagnus Hagander2020-03-31 16:13:41 +0000
commit6d6244a77d5f78a08d904004ef41808721ac14d1 (patch)
tree93e455900ab5c0d76049b31a0a70b55d057e9a37 /postgresqleu/invoices
parent52b52f86add49409759900cea07df9fd8cac6248 (diff)
Create abstraction for getting "today"
This will work differently for conferences and non-conferences once we add proper timezone support, so abstract it out into a separate couple of functions. For now they both return the same thing, but this will change in a later commit. In passing, fix missing datetime.now() -> timezone.now() conversions.
Diffstat (limited to 'postgresqleu/invoices')
-rw-r--r--postgresqleu/invoices/views.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/postgresqleu/invoices/views.py b/postgresqleu/invoices/views.py
index d81a00f1..4a05275d 100644
--- a/postgresqleu/invoices/views.py
+++ b/postgresqleu/invoices/views.py
@@ -10,12 +10,13 @@ from django.conf import settings
import base64
import io
-from datetime import datetime, timedelta
+from datetime import timedelta
from decimal import Decimal
from postgresqleu.util.auth import authenticate_backend_group
from postgresqleu.util.pagination import simple_pagination
from postgresqleu.util.request import get_int_or_error
+from postgresqleu.util.time import today_global
from .models import Invoice, InvoiceRow, InvoiceHistory, InvoicePaymentMethod, VatRate
from .models import InvoiceRefund
from .forms import InvoiceForm, InvoiceRowForm, RefundForm
@@ -116,8 +117,8 @@ def oneinvoice(request, invoicenum):
# since they're all based on the same model and form.
if invoicenum == 'new':
invoice = Invoice(
- invoicedate=datetime.today(),
- duedate=datetime.today() + timedelta(days=30),
+ invoicedate=today_global(),
+ duedate=today_global() + timedelta(days=30),
)
else:
invoice = get_object_or_404(Invoice, pk=invoicenum)