1
0
forked from erp-dev/erp

feat: new admin for new module

This commit is contained in:
2026-01-13 18:23:42 +08:00
parent 6b6d2a97b6
commit 96ac459964

View File

@@ -38,10 +38,17 @@ class ShipmentAdmin(admin.ModelAdmin):
@admin.register(SalesItem) @admin.register(SalesItem)
class SalesItemAdmin(admin.ModelAdmin): class SalesItemAdmin(admin.ModelAdmin):
list_display = ['id', 'name', 'quantity', 'unit', 'shipment', 'printing_job_id', 'customer_id', 'created_by', 'created_at'] list_display = ['id', 'name', 'quantity', 'unit', 'shipment_status', 'printing_job_id', 'customer_id', 'created_by', 'created_at']
list_filter = ['unit', 'created_at'] list_filter = ['unit', 'created_at', ('shipment', admin.EmptyFieldListFilter)]
search_fields = ['name', 'shipment__customer__name'] search_fields = ['name', 'shipment__customer__name']
readonly_fields = ['created_at', 'updated_at', 'created_by'] readonly_fields = ['created_at', 'updated_at', 'created_by']
raw_id_fields = ['shipment']
def shipment_status(self, obj):
if obj.shipment:
return f'出货单 #{obj.shipment.id}'
return '待分配'
shipment_status.short_description = '出货单'
def save_model(self, request, obj, form, change): def save_model(self, request, obj, form, change):
if not change: if not change: