Add autocomplete fields to "order" admin pages

This commit is contained in:
Oliver 2021-12-04 20:09:39 +11:00
parent e83b5f9db0
commit 1667af4c07

View File

@ -42,6 +42,8 @@ class PurchaseOrderAdmin(ImportExportModelAdmin):
PurchaseOrderLineItemInlineAdmin
]
autocomplete_fields = ('supplier',)
class SalesOrderAdmin(ImportExportModelAdmin):
@ -63,6 +65,8 @@ class SalesOrderAdmin(ImportExportModelAdmin):
'description',
]
autocomplete_fields = ('customer',)
class POLineItemResource(ModelResource):
""" Class for managing import / export of POLineItem data """
@ -124,6 +128,10 @@ class PurchaseOrderLineItemAdmin(ImportExportModelAdmin):
'reference'
)
search_fields = ('reference',)
autocomplete_fields = ('order', 'part', 'destination',)
class SalesOrderLineItemAdmin(ImportExportModelAdmin):
@ -136,6 +144,15 @@ class SalesOrderLineItemAdmin(ImportExportModelAdmin):
'reference'
)
search_fields = [
'part__name',
'order__reference',
'order__customer__name',
'reference',
]
autocomplete_fields = ('order', 'part',)
class SalesOrderShipmentAdmin(ImportExportModelAdmin):
@ -145,6 +162,14 @@ class SalesOrderShipmentAdmin(ImportExportModelAdmin):
'reference',
]
search_fields = [
'reference',
'order__reference',
'order__customer__name',
]
autocomplete_fields = ('order',)
class SalesOrderAllocationAdmin(ImportExportModelAdmin):
@ -154,6 +179,8 @@ class SalesOrderAllocationAdmin(ImportExportModelAdmin):
'quantity'
)
autocomplete_fields = ('line', 'shipment', 'item',)
admin.site.register(PurchaseOrder, PurchaseOrderAdmin)
admin.site.register(PurchaseOrderLineItem, PurchaseOrderLineItemAdmin)