mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	[UI] Sales order button (#9938)
* Refactor stock actions into a hook * Cleanup hooks * Allow transfer of "incomplete" outputs * Simplify even further * Enable transfer of stock allocated to build order * Remove StockItemBriefSerializer entirely * stock actions for items allocated to sales order * Refactor <PartDetail> page * Refactor <StockDetail> * Refactor <LocationDetail> * Bump API version * SO button text - Observe the "SALESORDER_SHIP_COMPLETE" value * Fix palywright tests
This commit is contained in:
		| @@ -1,12 +1,16 @@ | ||||
| """InvenTree API version information.""" | ||||
|  | ||||
| # InvenTree API version | ||||
| INVENTREE_API_VERSION = 359 | ||||
| INVENTREE_API_VERSION = 360 | ||||
|  | ||||
| """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" | ||||
|  | ||||
| INVENTREE_API_TEXT = """ | ||||
|  | ||||
| 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 | ||||
|  | ||||
| v359 -> 2025-07-01 : https://github.com/inventree/InvenTree/pull/9909 | ||||
|     - Fixes annotated types for various part fields | ||||
|  | ||||
|   | ||||
| @@ -42,7 +42,7 @@ from stock.generators import generate_batch_code | ||||
| from stock.models import StockItem, StockLocation | ||||
| from stock.serializers import ( | ||||
|     LocationBriefSerializer, | ||||
|     StockItemSerializerBrief, | ||||
|     StockItemSerializer, | ||||
|     StockStatusCustomSerializer, | ||||
| ) | ||||
| from stock.status_codes import StockStatus | ||||
| @@ -1227,7 +1227,7 @@ class BuildItemSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali | ||||
|         pricing=False, | ||||
|     ) | ||||
|  | ||||
|     stock_item_detail = StockItemSerializerBrief( | ||||
|     stock_item_detail = StockItemSerializer( | ||||
|         source='stock_item', read_only=True, allow_null=True, label=_('Stock Item') | ||||
|     ) | ||||
|  | ||||
|   | ||||
| @@ -1430,7 +1430,7 @@ class SalesOrderAllocationSerializer(InvenTreeModelSerializer): | ||||
|     part_detail = PartBriefSerializer( | ||||
|         source='item.part', many=False, read_only=True, allow_null=True | ||||
|     ) | ||||
|     item_detail = stock.serializers.StockItemSerializerBrief( | ||||
|     item_detail = stock.serializers.StockItemSerializer( | ||||
|         source='item', many=False, read_only=True, allow_null=True | ||||
|     ) | ||||
|     location_detail = stock.serializers.LocationBriefSerializer( | ||||
|   | ||||
| @@ -307,41 +307,6 @@ class StockItemTestResultSerializer( | ||||
|         return data | ||||
|  | ||||
|  | ||||
| class StockItemSerializerBrief( | ||||
|     InvenTree.serializers.NotesFieldMixin, | ||||
|     InvenTree.serializers.InvenTreeModelSerializer, | ||||
| ): | ||||
|     """Brief serializers for a StockItem.""" | ||||
|  | ||||
|     class Meta: | ||||
|         """Metaclass options.""" | ||||
|  | ||||
|         model = StockItem | ||||
|         fields = [ | ||||
|             'part', | ||||
|             'part_name', | ||||
|             'pk', | ||||
|             'location', | ||||
|             'quantity', | ||||
|             'serial', | ||||
|             'batch', | ||||
|             'supplier_part', | ||||
|             'barcode_hash', | ||||
|         ] | ||||
|  | ||||
|         read_only_fields = ['barcode_hash'] | ||||
|  | ||||
|     part_name = serializers.CharField(source='part.full_name', read_only=True) | ||||
|  | ||||
|     quantity = InvenTreeDecimalField() | ||||
|  | ||||
|     def validate_serial(self, value): | ||||
|         """Make sure serial is not to big.""" | ||||
|         if abs(InvenTree.helpers.extract_int(value)) > 0x7FFFFFFF: | ||||
|             raise serializers.ValidationError(_('Serial number is too large')) | ||||
|         return value | ||||
|  | ||||
|  | ||||
| @register_importer() | ||||
| class StockItemSerializer( | ||||
|     DataImportExportSerializerMixin, | ||||
| @@ -1336,7 +1301,7 @@ class StockTrackingSerializer( | ||||
|  | ||||
|     label = serializers.CharField(read_only=True) | ||||
|  | ||||
|     item_detail = StockItemSerializerBrief( | ||||
|     item_detail = StockItemSerializer( | ||||
|         source='item', many=False, read_only=True, allow_null=True | ||||
|     ) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user