feat(#46): add code to Sale and CatalogSale models

This commit is contained in:
mono
2026-08-08 13:28:49 -05:00
parent b2312edff5
commit 332884907c
2 changed files with 32 additions and 0 deletions

View File

@@ -4,6 +4,11 @@ from .products import Product
from .payments import PaymentMethods, ReconciliationJar
from django.core.exceptions import ValidationError
from datetime import datetime
import uuid
def generate_order_code():
return uuid.uuid4().hex
class SaleAbstractModel(models.Model):
@@ -11,6 +16,9 @@ class SaleAbstractModel(models.Model):
date = models.DateTimeField("Date")
phone = models.CharField(max_length=13, null=True, blank=True)
description = models.CharField(max_length=255, null=True, blank=True)
code = models.CharField(
max_length=32, default=generate_order_code, editable=False
)
class Meta:
abstract = True