Allow to extend expired order even if waiting list entries exist

This commit is contained in:
Raphael Michel
2017-09-12 18:50:13 +02:00
parent 94a97fb0fd
commit e5728662c5
3 changed files with 24 additions and 3 deletions

View File

@@ -333,7 +333,7 @@ class Order(LoggedModel):
return self._is_still_available()
def _is_still_available(self, now_dt: datetime=None) -> Union[bool, str]:
def _is_still_available(self, now_dt: datetime=None, count_waitinglist=True) -> Union[bool, str]:
error_messages = {
'unavailable': _('The ordered product "{item}" is no longer available.'),
}
@@ -351,7 +351,7 @@ class Order(LoggedModel):
for quota in quotas:
if quota.id not in quota_cache:
quota_cache[quota.id] = quota
quota.cached_availability = quota.availability(now_dt)[1]
quota.cached_availability = quota.availability(now_dt, count_waitinglist=count_waitinglist)[1]
else:
# Use cached version
quota = quota_cache[quota.id]