Fixes validation error in models.py for adding discounts
This commit is contained in:
parent
a4de15830c
commit
99f4b8dfe0
1 changed files with 2 additions and 2 deletions
|
@ -149,7 +149,7 @@ class DiscountForProduct(models.Model):
|
|||
cats = DiscountForCategory.objects.filter(
|
||||
discount=self.discount,
|
||||
category=self.product.category)
|
||||
if len(prods) > 1 or self not in prods:
|
||||
if len(prods) > 1:
|
||||
raise ValidationError(
|
||||
_("You may only have one discount line per product"))
|
||||
if len(cats) != 0:
|
||||
|
@ -185,7 +185,7 @@ class DiscountForCategory(models.Model):
|
|||
raise ValidationError(
|
||||
_("You may only have one discount for "
|
||||
"a product or its category"))
|
||||
if len(cats) > 1 or self not in cats:
|
||||
if len(cats) > 1:
|
||||
raise ValidationError(
|
||||
_("You may only have one discount line per category"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue