feat(#46): add code to Sale and CatalogSale models
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user