From 4cb18218b22a347d6b3112b87b21607f14680a25 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 25 Sep 2020 18:01:50 +0200 Subject: [PATCH] Do not show event time on invoice --- src/pretix/base/invoice.py | 6 +++--- src/pretix/base/models/event.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pretix/base/invoice.py b/src/pretix/base/invoice.py index a6a6f3c17..c3b55709f 100644 --- a/src/pretix/base/invoice.py +++ b/src/pretix/base/invoice.py @@ -396,13 +396,13 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer): p_str = ( shorten(self.invoice.event.name) + '\n' + pgettext('invoice', '{from_date}\nuntil {to_date}').format( - from_date=self.invoice.event.get_date_from_display(), - to_date=self.invoice.event.get_date_to_display() + from_date=self.invoice.event.get_date_from_display(show_times=False), + to_date=self.invoice.event.get_date_to_display(show_times=False) ) ) else: p_str = ( - shorten(self.invoice.event.name) + '\n' + self.invoice.event.get_date_from_display() + shorten(self.invoice.event.name) + '\n' + self.invoice.event.get_date_from_display(show_times=False) ) else: p_str = shorten(self.invoice.event.name) diff --git a/src/pretix/base/models/event.py b/src/pretix/base/models/event.py index b58a73d80..8fe541b6c 100644 --- a/src/pretix/base/models/event.py +++ b/src/pretix/base/models/event.py @@ -89,7 +89,7 @@ class EventMixin: self.date_from.astimezone(tz), "TIME_FORMAT" ) - def get_date_to_display(self, tz=None, short=False) -> str: + def get_date_to_display(self, tz=None, show_times=True, short=False) -> str: """ Returns a formatted string containing the start date of the event with respect to the current locale and to the ``show_times`` setting. Returns an empty string @@ -100,7 +100,7 @@ class EventMixin: return "" return _date( self.date_to.astimezone(tz), - ("SHORT_" if short else "") + ("DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT") + ("SHORT_" if short else "") + ("DATETIME_FORMAT" if self.settings.show_times and show_times else "DATE_FORMAT") ) def get_date_range_display(self, tz=None, force_show_end=False) -> str: