Disable eboutic in counter click/main

This commit is contained in:
Antoine Bartuccio 2024-12-23 01:35:44 +01:00
parent 9c93c004ec
commit 2e5e217842
3 changed files with 19 additions and 1 deletions

View File

@ -70,7 +70,7 @@ class FullClickSetup:
cls.customer_old_can_not_buy = old_subscriber_user.make() cls.customer_old_can_not_buy = old_subscriber_user.make()
cls.customer_can_not_buy = baker.make(User) cls.customer_can_not_buy = baker.make(User)
cls.club_counter = baker.make(Counter) cls.club_counter = baker.make(Counter, type="OFFICE")
baker.make( baker.make(
Membership, Membership,
start_date=now() - timedelta(days=30), start_date=now() - timedelta(days=30),
@ -302,6 +302,18 @@ class TestCounterClick(FullClickSetup, TestCase):
def refill_user(self, user: User, amount: Decimal | int): def refill_user(self, user: User, amount: Decimal | int):
baker.make(Refilling, amount=amount, customer=user.customer, is_validated=False) baker.make(Refilling, amount=amount, customer=user.customer, is_validated=False)
def test_click_eboutic_failure(self):
eboutic = baker.make(Counter, type="EBOUTIC")
self.client.force_login(self.club_admin)
assert (
self.submit_basket(
self.customer,
[BasketItem(self.stamps.id, 5)],
counter=eboutic,
).status_code
== 404
)
def test_click_office_success(self): def test_click_office_success(self):
self.refill_user(self.customer, 10) self.refill_user(self.customer, 10)
self.client.force_login(self.club_admin) self.client.force_login(self.club_admin)

View File

@ -148,6 +148,9 @@ class CounterClick(CounterTabsMixin, CanViewMixin, SingleObjectMixin, FormView):
pk_url_kwarg = "counter_id" pk_url_kwarg = "counter_id"
current_tab = "counter" current_tab = "counter"
def get_queryset(self):
return super().get_queryset().exclude(type="EBOUTIC")
def get_form_kwargs(self): def get_form_kwargs(self):
kwargs = super().get_form_kwargs() kwargs = super().get_form_kwargs()
kwargs["form_kwargs"] = { kwargs["form_kwargs"] = {

View File

@ -43,6 +43,9 @@ class CounterMain(
) )
current_tab = "counter" current_tab = "counter"
def get_queryset(self):
return super().get_queryset().exclude(type="EBOUTIC")
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
self.object = self.get_object() self.object = self.get_object()
if self.object.type == "BAR" and not ( if self.object.type == "BAR" and not (