1
0
forked from erp-dev/erp

feat: printing orders and jobs filter with external_order_id

This commit is contained in:
2026-03-20 22:36:31 +08:00
parent fa9721762c
commit b58667ca52
5 changed files with 142 additions and 7 deletions

View File

@@ -186,19 +186,65 @@ class PrintingJobInline(admin.StackedInline):
@admin.register(models.PrintingOrder)
class PrintingOrderAdmin(admin.ModelAdmin):
list_display = (
'oid',
'customer_name',
'oid',
'external_order_id',
'external_customer_name',
'external_employee_name',
'customer_name',
'progress_percent',
'created_at',
'created_at',
'outgoing_date',
)
search_fields = (
'=id',
'external_order_id',
'external_customer_id',
'external_customer_name',
'external_employee_name',
'customer__name',
'fabric',
'craft',
'description',
)
readonly_fields = ('external_raw_pretty',)
fieldsets = (
('基础信息', {
'fields': (
'customer', 'fabric', 'width', 'is_urgent', 'area', 'address',
'fabric_source', 'is_fabric_received', 'craft', 'description',
'outgoing_date', 'curve', 'new_curve', 'position',
'printing_warn', 'rolling_warn', 'production_warn',
'is_invalid', 'process',
)
}),
('外部同步信息', {
'fields': (
'external_order_id',
'external_customer_id',
'external_customer_name',
'external_employee_name',
'external_raw_pretty',
),
'classes': ('collapse',),
}),
)
@admin.display(description='外部订单编号')
def external_order_id(self, obj):
return obj.external_order_id or '-'
@admin.display(description='外部客户名')
def external_customer_name(self, obj):
return obj.external_customer_name or '-'
@admin.display(description='外部员工名')
def external_employee_name(self, obj):
return obj.external_employee_name or '-'
@admin.display(description='外部原始数据')
def external_raw_pretty(self, obj):
import json
return format_html('<pre style="white-space: pre-wrap;">{}</pre>', json.dumps(obj.external_raw or {}, ensure_ascii=False, indent=2))
def save_formset(self, request, form, formset, change):