mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Allocation search by IPN (#9944)
* Fix for "has_ipn" filter * Enable filtering and sorting by IPN in SalesOrderAllocation table * Bump API version
This commit is contained in:
		| @@ -1,12 +1,16 @@ | ||||
| """InvenTree API version information.""" | ||||
|  | ||||
| # InvenTree API version | ||||
| INVENTREE_API_VERSION = 360 | ||||
| INVENTREE_API_VERSION = 361 | ||||
|  | ||||
| """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" | ||||
|  | ||||
| INVENTREE_API_TEXT = """ | ||||
|  | ||||
| v361 -> 2025-07-03 : https://github.com/inventree/InvenTree/pull/9944 | ||||
|     - Enable SalesOrderAllocation list to be filtered by part IPN value | ||||
|     - Enable SalesOrderAllocation list to be ordered by part MPN value | ||||
|  | ||||
| v360 -> 2025-07-02 : https://github.com/inventree/InvenTree/pull/9937 | ||||
|     - Provide more detailed StockItem information in the BuildItem serializer | ||||
|     - Provide more detailed StockItem information in the SalesOrderAllocation serializer | ||||
|   | ||||
| @@ -1217,6 +1217,7 @@ class SalesOrderAllocationList(SalesOrderAllocationMixin, BulkUpdateMixin, ListA | ||||
|         'quantity', | ||||
|         'part', | ||||
|         'serial', | ||||
|         'IPN', | ||||
|         'batch', | ||||
|         'location', | ||||
|         'order', | ||||
| @@ -1224,6 +1225,7 @@ class SalesOrderAllocationList(SalesOrderAllocationMixin, BulkUpdateMixin, ListA | ||||
|     ] | ||||
|  | ||||
|     ordering_field_aliases = { | ||||
|         'IPN': 'item__part__IPN', | ||||
|         'part': 'item__part__name', | ||||
|         'serial': ['item__serial_int', 'item__serial'], | ||||
|         'batch': 'item__batch', | ||||
| @@ -1232,7 +1234,12 @@ class SalesOrderAllocationList(SalesOrderAllocationMixin, BulkUpdateMixin, ListA | ||||
|         'shipment_date': 'shipment__shipment_date', | ||||
|     } | ||||
|  | ||||
|     search_fields = {'item__part__name', 'item__serial', 'item__batch'} | ||||
|     search_fields = { | ||||
|         'item__part__name', | ||||
|         'item__part__IPN', | ||||
|         'item__serial', | ||||
|         'item__batch', | ||||
|     } | ||||
|  | ||||
|     def get_serializer(self, *args, **kwargs): | ||||
|         """Return the serializer instance for this endpoint. | ||||
|   | ||||
| @@ -716,8 +716,8 @@ class PartFilter(rest_filters.FilterSet): | ||||
|     def filter_has_ipn(self, queryset, name, value): | ||||
|         """Filter by whether the Part has an IPN (internal part number) or not.""" | ||||
|         if str2bool(value): | ||||
|             return queryset.exclude(IPN='') | ||||
|         return queryset.filter(IPN='') | ||||
|             return queryset.exclude(IPN='').exclude(IPN=None) | ||||
|         return queryset.filter(Q(IPN='') | Q(IPN=None)).distinct() | ||||
|  | ||||
|     # Regex filter for name | ||||
|     name_regex = rest_filters.CharFilter( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user