feat: add CatalogSale model with abstract base classes for Sale/SaleLine
- Introduced SaleAbstractModel and SaleLineAbstractModel as abstract bases - Added CatalogSale and CatalogSaleLine models inheriting from them - Created migration 0045 for new models - Added CatalogSaleView, CatalogSaleSerializer with nested line creation - Registered new models in admin - Added catalog_sales router endpoint to URLs - Removed placeholder api/ package (now redundant)
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# Generated by Django 5.0.6 on 2026-05-28 21:29
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('don_confiao', '0044_alter_payment_type_payment_alter_sale_payment_method'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='CatalogSale',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('date', models.DateTimeField(verbose_name='Date')),
|
||||
('phone', models.CharField(blank=True, max_length=13, null=True)),
|
||||
('description', models.CharField(blank=True, max_length=255, null=True)),
|
||||
('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='don_confiao.customer')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CatalogSaleLine',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('quantity', models.DecimalField(decimal_places=2, max_digits=10, null=True)),
|
||||
('unit_price', models.DecimalField(decimal_places=2, max_digits=9)),
|
||||
('description', models.CharField(blank=True, max_length=255, null=True)),
|
||||
('catalog_sale', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='don_confiao.catalogsale')),
|
||||
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='don_confiao.product')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user