forbid minors from selling alcohol

This commit is contained in:
imperosol committed 2026-11-12 15:49:31 +01:00
1 parent e45b4eb9e0
commit 01112a89aa
3 files changed
+45 -2

No files matched your search

+11
View File
@@ -111,6 +111,17 @@ class CounterClick(
return redirect(obj) # Redirect to counter
self.prices = list(obj.get_prices_for(self.customer))
if any(user.age < 18 for user in request.barmen):
filtered = [p for p in self.prices if p.product.limit_age < 18]
if len(filtered) != len(self.prices):
self.prices = filtered
messages.warning(
request,
_(
"A minor is barman on this on this device, "
"so you cannot currently sell alcohol."
),
)
return super().dispatch(request, *args, **kwargs)