mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 21:25:42 +00:00 
			
		
		
		
	* Prevent installed items from being hidden
* Fix parent / child relationship
(cherry picked from commit f70294b247)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
			
			
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							db88fbda11
						
					
				
				
					commit
					6d6629f11c
				
			| @@ -2375,6 +2375,10 @@ function loadStockTable(table, options) { | ||||
|                     let row  = table.bootstrapTable('getRowByUniqueId', stock_item); | ||||
|                     row.installed_items_received = true; | ||||
|  | ||||
|                     for (let ii = 0; ii < response.length; ii++) { | ||||
|                         response[ii].belongs_to_item = stock_item; | ||||
|                     } | ||||
|  | ||||
|                     table.bootstrapTable('updateByUniqueId', stock_item, row, true); | ||||
|                     table.bootstrapTable('append', response); | ||||
|  | ||||
| @@ -2390,6 +2394,7 @@ function loadStockTable(table, options) { | ||||
|     } | ||||
|  | ||||
|     let parent_id = 'top-level'; | ||||
|     let loaded = false; | ||||
|  | ||||
|     table.inventreeTable({ | ||||
|         method: 'get', | ||||
| @@ -2405,13 +2410,25 @@ function loadStockTable(table, options) { | ||||
|         showFooter: true, | ||||
|         columns: columns, | ||||
|         treeEnable: show_installed_items, | ||||
|         rootParentId: parent_id, | ||||
|         parentIdField: 'belongs_to', | ||||
|         rootParentId: show_installed_items ? parent_id : null, | ||||
|         parentIdField: show_installed_items ? 'belongs_to_item' : null, | ||||
|         uniqueId: 'pk', | ||||
|         idField: 'pk', | ||||
|         treeShowField: 'part', | ||||
|         onPostBody: function() { | ||||
|         treeShowField: show_installed_items ? 'part' : null, | ||||
|         onLoadSuccess: function(data) { | ||||
|             let records = data.results || data; | ||||
|  | ||||
|             // Set the 'parent' ID for each root item | ||||
|             if (!loaded && show_installed_items) { | ||||
|                 for (let i = 0; i < records.length; i++) { | ||||
|                     records[i].belongs_to_item = parent_id; | ||||
|                 } | ||||
|  | ||||
|                 loaded = true; | ||||
|                 $(table).bootstrapTable('load', records); | ||||
|             } | ||||
|         }, | ||||
|         onPostBody: function() { | ||||
|             if (show_installed_items) { | ||||
|                 table.treegrid({ | ||||
|                     treeColumn: 1, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user