mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Merge remote-tracking branch 'inventree/master' into bom-serializer-quantity
This commit is contained in:
		| @@ -505,7 +505,12 @@ $("#barcode-unlink").click(function() { | ||||
| }); | ||||
|  | ||||
| $("#barcode-scan-into-location").click(function() { | ||||
|     scanItemsIntoLocation([{{ item.id }}]); | ||||
|      | ||||
|     inventreeGet('{% url "api-stock-detail" item.pk %}', {}, { | ||||
|         success: function(item) { | ||||
|             scanItemsIntoLocation([item]); | ||||
|         } | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| function itemAdjust(action) { | ||||
|   | ||||
| @@ -179,6 +179,11 @@ function showApiError(xhr, url) { | ||||
|     var title = null; | ||||
|     var message = null; | ||||
|  | ||||
|     if (xhr.statusText == 'abort') { | ||||
|         // Don't show errors for requests which were intentionally aborted | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     switch (xhr.status || 0) { | ||||
|     // No response | ||||
|     case 0: | ||||
|   | ||||
| @@ -359,14 +359,13 @@ function unlinkBarcode(stockitem) { | ||||
| /* | ||||
|  * Display dialog to check multiple stock items in to a stock location. | ||||
|  */ | ||||
| function barcodeCheckIn(location_id) { | ||||
| function barcodeCheckIn(location_id, options={}) { | ||||
|  | ||||
|     var modal = '#modal-form'; | ||||
|  | ||||
|     // List of items we are going to checkin | ||||
|     var items = []; | ||||
|  | ||||
|  | ||||
|     function reloadTable() { | ||||
|  | ||||
|         modalEnable(modal, false); | ||||
| @@ -389,10 +388,17 @@ function barcodeCheckIn(location_id) { | ||||
|             <tbody>`; | ||||
|  | ||||
|         items.forEach(function(item) { | ||||
|  | ||||
|             var location_info = `${item.location}`; | ||||
|  | ||||
|             if (item.location_detail) { | ||||
|                 location_info = `${item.location_detail.name}`; | ||||
|             } | ||||
|  | ||||
|             html += ` | ||||
|             <tr pk='${item.pk}'> | ||||
|                 <td>${imageHoverIcon(item.part_detail.thumbnail)} ${item.part_detail.name}</td> | ||||
|                 <td>${item.location_detail.name}</td> | ||||
|                 <td>${location_info}</td> | ||||
|                 <td>${item.quantity}</td> | ||||
|                 <td>${makeIconButton('fa-times-circle icon-red', 'button-item-remove', item.pk, '{% trans "Remove stock item" %}')}</td> | ||||
|             </tr>`; | ||||
| @@ -469,6 +475,12 @@ function barcodeCheckIn(location_id) { | ||||
|  | ||||
|                 data.items = entries; | ||||
|  | ||||
|                 // Prevent submission without any entries | ||||
|                 if (entries.length == 0) { | ||||
|                     showBarcodeMessage(modal, '{% trans "No barcode provided" %}', 'warning'); | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 inventreePut( | ||||
|                     '{% url "api-stock-transfer" %}', | ||||
|                     data, | ||||
| @@ -477,15 +489,11 @@ function barcodeCheckIn(location_id) { | ||||
|                         success: function(response, status) { | ||||
|                             // Hide the modal | ||||
|                             $(modal).modal('hide'); | ||||
|                             if (status == 'success' && 'success' in response) { | ||||
|  | ||||
|                                 addCachedAlert(response.success); | ||||
|                                 location.reload(); | ||||
|                             if (options.success) { | ||||
|                                 options.success(response); | ||||
|                             } else { | ||||
|                                 showMessage('{% trans "Error transferring stock" %}', { | ||||
|                                     style: 'danger', | ||||
|                                     icon: 'fas fa-times-circle', | ||||
|                                 }); | ||||
|                                 location.reload(); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
| @@ -533,7 +541,7 @@ function barcodeCheckIn(location_id) { | ||||
| /* | ||||
|  * Display dialog to check a single stock item into a stock location | ||||
|  */ | ||||
| function scanItemsIntoLocation(item_id_list, options={}) { | ||||
| function scanItemsIntoLocation(item_list, options={}) { | ||||
|  | ||||
|     var modal = options.modal || '#modal-form'; | ||||
|  | ||||
| @@ -583,9 +591,10 @@ function scanItemsIntoLocation(item_id_list, options={}) { | ||||
|  | ||||
|                 var items = []; | ||||
|  | ||||
|                 item_id_list.forEach(function(pk) { | ||||
|                 item_list.forEach(function(item) { | ||||
|                     items.push({ | ||||
|                         pk: pk, | ||||
|                         pk: item.pk || item.id, | ||||
|                         quantity: item.quantity,  | ||||
|                     }); | ||||
|                 }); | ||||
|  | ||||
| @@ -605,13 +614,10 @@ function scanItemsIntoLocation(item_id_list, options={}) { | ||||
|                             // First hide the modal | ||||
|                             $(modal).modal('hide'); | ||||
|  | ||||
|                             if (status == 'success' && 'success' in response) { | ||||
|                                 addCachedAlert(response.success); | ||||
|                                 location.reload(); | ||||
|                             if (options.success) { | ||||
|                                 options.success(response); | ||||
|                             } else { | ||||
|                                 showMessage('{% trans "Error transferring stock" %}', { | ||||
|                                     style: 'danger', | ||||
|                                 }); | ||||
|                                 location.reload(); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|   | ||||
| @@ -89,7 +89,8 @@ function updateSearch() { | ||||
|         var params = {}; | ||||
|  | ||||
|         if (user_settings.SEARCH_HIDE_INACTIVE_PARTS) { | ||||
|             params.active = false; | ||||
|             // Return *only* active parts | ||||
|             params.active = true; | ||||
|         } | ||||
|  | ||||
|         // Search for matching parts | ||||
|   | ||||
| @@ -1972,7 +1972,7 @@ function loadStockTable(table, options) { | ||||
|             var items = []; | ||||
|  | ||||
|             selections.forEach(function(item) { | ||||
|                 items.push(item.pk); | ||||
|                 items.push(item); | ||||
|             }); | ||||
|  | ||||
|             scanItemsIntoLocation(items); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user