Django_Basic_Manufacturing/manufacture/migrations/0001_initial.py

77 lines
4.3 KiB
Python

# Generated by Django 4.2.7 on 2025-08-18 02:27
from decimal import Decimal
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('inventory', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='ManufacturingLine',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('description', models.TextField(blank=True)),
('capacity_per_hour', models.DecimalField(blank=True, decimal_places=2, help_text='Production capacity per hour', max_digits=8, null=True)),
('is_active', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'verbose_name': 'Manufacturing Line',
'verbose_name_plural': 'Manufacturing Lines',
'ordering': ['name'],
},
),
migrations.CreateModel(
name='ManufacturingOrder',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('order_number', models.CharField(help_text='Unique manufacturing order number', max_length=50, unique=True)),
('date', models.DateField()),
('quantity', models.DecimalField(decimal_places=2, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))])),
('notes', models.TextField(blank=True, help_text='Manufacturing notes and instructions')),
('status', models.CharField(choices=[('completed', 'Completed'), ('in_progress', 'In Progress'), ('cancelled', 'Cancelled')], default='completed', max_length=20)),
('labor_cost', models.DecimalField(decimal_places=2, default=0, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0'))])),
('overhead_cost', models.DecimalField(decimal_places=2, default=0, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0'))])),
('total_cost', models.DecimalField(decimal_places=2, default=0, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0'))])),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='manufacturing_orders', to='inventory.product')),
],
options={
'verbose_name': 'Manufacturing Order',
'verbose_name_plural': 'Manufacturing Orders',
'ordering': ['-date', '-created_at'],
},
),
migrations.CreateModel(
name='ManufacturingOrderLine',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('start_time', models.DateTimeField(blank=True, null=True)),
('end_time', models.DateTimeField(blank=True, null=True)),
('actual_quantity', models.DecimalField(decimal_places=2, max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0'))])),
('notes', models.TextField(blank=True)),
('manufacturing_line', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='manufacture.manufacturingline')),
('manufacturing_order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lines', to='manufacture.manufacturingorder')),
],
options={
'verbose_name': 'Manufacturing Order Line',
'verbose_name_plural': 'Manufacturing Order Lines',
},
),
]