Commit 241650c1 authored by Sli's avatar Sli

counter: fix eticket server crash induced by old permission system and fix Selling permission

parent 81180989
Pipeline #2099 passed with stage
in 33 minutes and 55 seconds
......@@ -478,6 +478,8 @@ class Selling(models.Model):
return user.is_owner(self.counter) and self.payment_method != "CARD"
def can_be_viewed_by(self, user):
if not hasattr(self, "customer"): # Customer can be set to Null
return False
return user == self.customer.user
def delete(self, *args, **kwargs):
......
......@@ -1752,7 +1752,11 @@ class EticketPDFView(CanViewMixin, DetailView):
from reportlab.graphics.barcode.qr import QrCodeWidget
from reportlab.graphics import renderPDF
self.object = self.get_object()
if not (
hasattr(self.object, "product") and hasattr(self.object.product, "eticket")
):
raise Http404
eticket = self.object.product.eticket
user = self.object.customer.user
code = "%s %s %s %s" % (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment