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

This commit is contained in:
Antoine Bartuccio 2019-10-16 21:21:51 +02:00
parent 811809895e
commit 241650c171
Signed by: klmp200
GPG Key ID: E7245548C53F904B
2 changed files with 7 additions and 1 deletions

View File

@ -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):

View File

@ -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" % (