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

@@ -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()