mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	Delete locations fix (#10672)
* Cleaner handling of inputs * Fix for frontend form: - Fix typo in field - Better option defaults * Tweak part category delete form * Add frontend tests
This commit is contained in:
		| @@ -283,13 +283,11 @@ class CategoryDetail(CategoryMixin, OutputOptionsMixin, CustomRetrieveUpdateDest | ||||
|  | ||||
|     def destroy(self, request, *args, **kwargs): | ||||
|         """Delete a Part category instance via the API.""" | ||||
|         delete_parts = ( | ||||
|             'delete_parts' in request.data and request.data['delete_parts'] == '1' | ||||
|         ) | ||||
|         delete_child_categories = ( | ||||
|             'delete_child_categories' in request.data | ||||
|             and request.data['delete_child_categories'] == '1' | ||||
|         delete_parts = str2bool(request.data.get('delete_parts', False)) | ||||
|         delete_child_categories = str2bool( | ||||
|             request.data.get('delete_child_categories', False) | ||||
|         ) | ||||
|  | ||||
|         return super().destroy( | ||||
|             request, | ||||
|             *args, | ||||
|   | ||||
| @@ -431,8 +431,12 @@ class StockLocationDetail( | ||||
|  | ||||
|     def destroy(self, request, *args, **kwargs): | ||||
|         """Delete a Stock location instance via the API.""" | ||||
|         delete_stock_items = str(request.data.get('delete_stock_items', 0)) == '1' | ||||
|         delete_sub_locations = str(request.data.get('delete_sub_locations', 0)) == '1' | ||||
|         delete_stock_items = InvenTree.helpers.str2bool( | ||||
|             request.data.get('delete_stock_items', False) | ||||
|         ) | ||||
|         delete_sub_locations = InvenTree.helpers.str2bool( | ||||
|             request.data.get('delete_sub_locations', False) | ||||
|         ) | ||||
|  | ||||
|         return super().destroy( | ||||
|             request, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user