feat/46-order-summary-public #47
@@ -0,0 +1,24 @@
|
||||
# Generated by Django 5.0.6 on 2026-08-08 18:24
|
||||
|
||||
import don_confiao.models.sales
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('don_confiao', '0049_catalogueimage'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='catalogsale',
|
||||
name='code',
|
||||
field=models.CharField(default=don_confiao.models.sales.generate_order_code, editable=False, max_length=32),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='sale',
|
||||
name='code',
|
||||
field=models.CharField(default=don_confiao.models.sales.generate_order_code, editable=False, max_length=32),
|
||||
),
|
||||
]
|
||||
@@ -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