From 1667af4c07d5ad2d9a42333784fbe9466d9c5db9 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 4 Dec 2021 20:09:39 +1100 Subject: [PATCH] Add autocomplete fields to "order" admin pages --- InvenTree/order/admin.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/InvenTree/order/admin.py b/InvenTree/order/admin.py index 07a8e0ad0a..e98b31939a 100644 --- a/InvenTree/order/admin.py +++ b/InvenTree/order/admin.py @@ -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)