Skip to content

Commit

Permalink
Merge pull request #173 from andersinno/ttva-187-sap-invoice-xml-rese…
Browse files Browse the repository at this point in the history
…rvation-times

Invoice XML: Use correct timezone for reservation times (TTVA-187)
  • Loading branch information
jopesy authored Dec 20, 2023
2 parents 50162f9 + 015e024 commit 6a11e9e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions payments/sap_invoices.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytz

from django.conf import settings
from django.template import loader
from django.utils import timezone
Expand Down Expand Up @@ -75,9 +77,12 @@ def get_sales_orders(reservations):
}

if reservation.begin and reservation.end:
timezone = pytz.timezone(settings.TIME_ZONE)
begin = reservation.begin.astimezone(timezone)
end = reservation.end.astimezone(timezone)
billing_period = _("Invoice for reservation %(begin)s - %(end)s") % {
"begin": reservation.begin.strftime("%d.%m.%Y %H:%M"),
"end": reservation.end.strftime("%d.%m.%Y %H:%M"),
"begin": begin.strftime("%d.%m.%Y %H:%M"),
"end": end.strftime("%d.%m.%Y %H:%M"),
}
else:
billing_period = ""
Expand Down

0 comments on commit 6a11e9e

Please sign in to comment.