Implement flexible order status management system
Features: - Created OrderStatus model for managing statuses per tenant - Added system-level statuses: draft, new, confirmed, in_assembly, in_delivery, completed, return, cancelled - Implemented CRUD views for managing order statuses - Created OrderStatusService with status transitions and business logic hooks - Updated Order model to use ForeignKey to OrderStatus - Added is_returned flag for tracking returned orders - Updated filters to work with new OrderStatus model - Created management command for status initialization - Added HTML templates for status list, form, and confirmation - Fixed views.py to use OrderStatus instead of removed STATUS_CHOICES 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Generated by Django 5.0.10 on 2025-11-09 22:18
|
||||
# Generated by Django 5.0.10 on 2025-11-13 13:12
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
@@ -177,15 +177,14 @@ class Migration(migrations.Migration):
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=100, unique=True, verbose_name='Название')),
|
||||
('slug', models.SlugField(max_length=100, unique=True, verbose_name='URL-идентификатор')),
|
||||
('is_active', models.BooleanField(db_index=True, default=True, verbose_name='Активен')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Дата создания')),
|
||||
('updated_at', models.DateTimeField(auto_now=True, null=True, verbose_name='Дата обновления')),
|
||||
('is_deleted', models.BooleanField(db_index=True, default=False, verbose_name='Удален')),
|
||||
('deleted_at', models.DateTimeField(blank=True, null=True, verbose_name='Время удаления')),
|
||||
('deleted_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='deleted_tags', to=settings.AUTH_USER_MODEL, verbose_name='Удален пользователем')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Тег товара',
|
||||
'verbose_name_plural': 'Теги товаров',
|
||||
'indexes': [models.Index(fields=['is_active'], name='products_pr_is_acti_7f288f_idx')],
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
@@ -294,14 +293,6 @@ class Migration(migrations.Migration):
|
||||
model_name='productphoto',
|
||||
index=models.Index(fields=['quality_warning', 'product'], name='products_pr_quality_6e8b51_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='producttag',
|
||||
index=models.Index(fields=['is_deleted'], name='products_pr_is_dele_ea9be0_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='producttag',
|
||||
index=models.Index(fields=['is_deleted', 'created_at'], name='products_pr_is_dele_bc2d9c_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='productkit',
|
||||
index=models.Index(fields=['is_temporary'], name='products_pr_is_temp_e407a2_idx'),
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
# Generated by Django 5.0.10 on 2025-11-11 18:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('products', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveIndex(
|
||||
model_name='producttag',
|
||||
name='products_pr_is_dele_ea9be0_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='producttag',
|
||||
name='products_pr_is_dele_bc2d9c_idx',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='producttag',
|
||||
name='deleted_at',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='producttag',
|
||||
name='deleted_by',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='producttag',
|
||||
name='is_deleted',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='producttag',
|
||||
name='is_active',
|
||||
field=models.BooleanField(db_index=True, default=True, verbose_name='Активен'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='producttag',
|
||||
index=models.Index(fields=['is_active'], name='products_pr_is_acti_7f288f_idx'),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user