From 66495e25ffd433708be452ef2a2628c49bf4f5a3 Mon Sep 17 00:00:00 2001 From: Mono Mono Date: Sat, 9 Nov 2024 13:55:59 -0500 Subject: [PATCH] style(Purchase) --- tienda_ilusion/don_confiao/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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):