forked from erp-dev/erp
clean
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user