1
0
forked from erp-dev/erp
This commit is contained in:
2025-12-19 10:34:28 +08:00
parent 1a6ce32441
commit 545be7ff6b
7 changed files with 59924 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.2.8 on 2025-12-19 01:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api_v1', '0007_mdy_plate_order_staging_ctime_utime'),
]
operations = [
migrations.AlterField(
model_name='datasync',
name='table_name',
field=models.CharField(choices=[('product', '产品'), ('customer', '客户'), ('plate_order', '开版(明道云)')], max_length=50, verbose_name='同步目标'),
),
]

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -37,6 +37,10 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# Initialize environment variables
Env.read_env(str(BASE_DIR / '.env'))
# 允许一次请求携带更多表单字段,避免 admin 批量操作时报 TooManyFieldsSent
# Django 默认 DATA_UPLOAD_MAX_NUMBER_FIELDS=1000当一次 POST/GET 的字段(含重复 key过多会直接抛异常。
DATA_UPLOAD_MAX_NUMBER_FIELDS = env.int('DATA_UPLOAD_MAX_NUMBER_FIELDS', default=20000)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/

View File

@@ -191,6 +191,13 @@ class PrintingOrderAdmin(admin.ModelAdmin):
'created_at',
'outgoing_date',
)
search_fields = (
'=id',
'customer__name',
'fabric',
'craft',
'description',
)
inlines = [PrintingJobInline]
def save_formset(self, request, form, formset, change):
@@ -427,3 +434,36 @@ class PrintingJobAdmin(admin.ModelAdmin):
reset_count += 1
self.message_user(request, f'已重置 {reset_count} 个印染任务的进度。')
@admin.register(models.PrintingJobBatchAdvanceRecord)
class PrintingJobBatchAdvanceRecordAdmin(admin.ModelAdmin):
list_display = (
'id',
'printing_order',
'state',
'created_by',
'jobs_count',
'created_at',
)
list_filter = (
'state',
'created_by',
'created_at',
)
search_fields = (
'printing_order__customer__name',
'state__name',
'created_by__username',
)
readonly_fields = (
'created_at',
'updated_at',
)
date_hierarchy = 'created_at'
ordering = ('-created_at',)
autocomplete_fields = ('printing_order', 'state', 'created_by', 'printing_jobs')
@admin.display(description='涉及任务数')
def jobs_count(self, obj: models.PrintingJobBatchAdvanceRecord) -> int:
return obj.printing_jobs.count()