style(Purchase)

This commit is contained in:
Mono Mono 2024-11-09 13:55:59 -05:00
parent b7c4cf5d44
commit 66495e25ff

View File

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