counter: fix Selling view permission

This commit is contained in:
Antoine Bartuccio 2019-10-17 11:11:13 +02:00
parent a6088c0e4a
commit 566dcc7aee
Signed by: klmp200
GPG Key ID: E7245548C53F904B

View File

@ -478,7 +478,9 @@ class Selling(models.Model):
return user.is_owner(self.counter) and self.payment_method != "CARD" return user.is_owner(self.counter) and self.payment_method != "CARD"
def can_be_viewed_by(self, user): def can_be_viewed_by(self, user):
if not hasattr(self, "customer"): # Customer can be set to Null if (
not hasattr(self, "customer") or self.customer is None
): # Customer can be set to Null
return False return False
return user == self.customer.user return user == self.customer.user