diff --git a/counter/models.py b/counter/models.py index 3d3fef5b..6ec5796b 100644 --- a/counter/models.py +++ b/counter/models.py @@ -39,7 +39,7 @@ import os import base64 import datetime -from club.models import Club +from club.models import Club, Membership from accounting.models import CurrencyField from core.models import Group, User, Notification from subscription.models import Subscription @@ -342,6 +342,14 @@ class Counter(models.Model): """ return [b.id for b in self.get_barmen_list()] + def can_refill(self): + is_ae_member = False + ae = Club.objects.get(unix_name="ae") + for barman in self.get_barmen_list(): + if Membership.objects.filter(club=ae, user=barman): + is_ae_member = True + return is_ae_member + class Refilling(models.Model): """ diff --git a/counter/templates/counter/counter_click.jinja b/counter/templates/counter/counter_click.jinja index 06cb191b..b9238b89 100644 --- a/counter/templates/counter/counter_click.jinja +++ b/counter/templates/counter/counter_click.jinja @@ -107,7 +107,7 @@ - {% if counter.type == 'BAR' %} + {% if (counter.type == 'BAR' and barmens_can_refill) %}