diff --git a/tienda_ilusion/don_confiao/models.py b/tienda_ilusion/don_confiao/models.py index 54a96f1..ca59980 100644 --- a/tienda_ilusion/don_confiao/models.py +++ b/tienda_ilusion/don_confiao/models.py @@ -83,8 +83,8 @@ class Sale(models.Model): return sum([l.quantity * l.unit_price for l in lines]) def clean(self): - if self.payment_method not in [choice[0] for choice in PaymentMethods.choices]: - raise ValidationError({'payment_method': f"Null or invalid payment method ({self.payment_method}, {PaymentMethods.choices})"}) + if self.payment_method not in PaymentMethods.values: + raise ValidationError({'payment_method': "Invalid payment method"}) @classmethod def sale_header_csv(cls):