Payment deadline delay: Respect week days

This commit is contained in:
Raphael Michel
2023-07-27 13:49:31 +02:00
parent 8e603410fa
commit ef0024b2ef
4 changed files with 26 additions and 5 deletions

View File

@@ -907,6 +907,11 @@ class Order(LockModel, LoggedModel):
return self.expires
expires = self.expires.date() + timedelta(days=delay)
if self.event.settings.get('payment_term_weekdays'):
if expires.weekday() == 5:
expires += timedelta(days=2)
elif expires.weekday() == 6:
expires += timedelta(days=1)
tz = ZoneInfo(self.event.settings.timezone)
expires = make_aware(datetime.combine(

View File

@@ -941,9 +941,9 @@ DEFAULTS = {
'form_kwargs': dict(
label=_('Expiration delay'),
help_text=_("The order will only actually expire this many days after the expiration date communicated "
"to the customer. However, this will not delay beyond the \"last date of payments\" "
"configured above, which is always enforced. The delay may also end on a weekend regardless "
"of the other settings above."),
"to the customer. If you select \"Only end payment terms on weekdays\" above, this will also "
"be respected. However, this will not delay beyond the \"last date of payments\" "
"configured above, which is always enforced."),
# Every order in between the official expiry date and the delayed expiry date has a performance penalty
# for the cron job, so we limit this feature to 30 days to prevent arbitrary numbers of orders needing
# to be checked.