feat: Add customer information to CatalogSale

This commit is contained in:
2026-06-05 09:11:52 -05:00
parent ff67720cea
commit 77761ea8cc
3 changed files with 58 additions and 5 deletions

View File

@@ -20,7 +20,9 @@ class SaleLineAbstractModel(models.Model):
product = models.ForeignKey(
Product, null=False, blank=False, on_delete=models.CASCADE
)
quantity = models.DecimalField(max_digits=10, decimal_places=2, null=True)
quantity = models.DecimalField(
max_digits=10, decimal_places=2, null=True
)
unit_price = models.DecimalField(max_digits=9, decimal_places=2)
description = models.CharField(max_length=255, null=True, blank=True)
@@ -53,7 +55,9 @@ class Sale(SaleAbstractModel):
def clean(self):
if self.payment_method not in PaymentMethods.values:
raise ValidationError({"payment_method": "Invalid payment method"})
raise ValidationError(
{"payment_method": "Invalid payment method"}
)
@classmethod
def sale_header_csv(cls):
@@ -71,6 +75,12 @@ class SaleLine(SaleLineAbstractModel):
class CatalogSale(SaleAbstractModel):
external_id = models.CharField(max_length=100, null=True, blank=True)
customer_name = models.CharField(max_length=255, null=True, blank=True)
customer_phone = models.CharField(max_length=13, null=True, blank=True)
customer_address = models.CharField(
max_length=255, null=True, blank=True
)
pickup_method = models.CharField(max_length=30, null=True, blank=True)
def __str__(self):
return f"{self.date} {self.customer}"