mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	Reload the untracked stock table when allocation actions are performed
This commit is contained in:
		@@ -431,6 +431,8 @@ onPanelLoad('outputs', function() {
 | 
			
		||||
 | 
			
		||||
{% if build.active and build.has_untracked_bom_items %}
 | 
			
		||||
 | 
			
		||||
function loadUntrackedStockTable() {
 | 
			
		||||
 | 
			
		||||
    var build_info = {
 | 
			
		||||
        pk: {{ build.pk }},
 | 
			
		||||
        part: {{ build.part.pk }},
 | 
			
		||||
@@ -441,6 +443,8 @@ var build_info = {
 | 
			
		||||
        tracked_parts: false,
 | 
			
		||||
    };
 | 
			
		||||
    
 | 
			
		||||
    $('#allocation-table-untracked').bootstrapTable('destroy');
 | 
			
		||||
 | 
			
		||||
    // Load allocation table for un-tracked parts
 | 
			
		||||
    loadBuildOutputAllocationTable(
 | 
			
		||||
        build_info,
 | 
			
		||||
@@ -449,6 +453,10 @@ loadBuildOutputAllocationTable(
 | 
			
		||||
            search: true,
 | 
			
		||||
        }
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
loadUntrackedStockTable();
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
$('#btn-create-output').click(function() {
 | 
			
		||||
@@ -472,6 +480,7 @@ $("#btn-auto-allocate").on('click', function() {
 | 
			
		||||
            {% if build.take_from %}
 | 
			
		||||
            location: {{ build.take_from.pk }},
 | 
			
		||||
            {% endif %}
 | 
			
		||||
            onSuccess: loadUntrackedStockTable,
 | 
			
		||||
        }
 | 
			
		||||
    );
 | 
			
		||||
});
 | 
			
		||||
@@ -503,9 +512,7 @@ $("#btn-allocate").on('click', function() {
 | 
			
		||||
                {% if build.take_from %}
 | 
			
		||||
                source_location: {{ build.take_from.pk }},
 | 
			
		||||
                {% endif %}
 | 
			
		||||
                success: function(data) {
 | 
			
		||||
                    $('#allocation-table-untracked').bootstrapTable('refresh');
 | 
			
		||||
                }
 | 
			
		||||
                success: loadUntrackedStockTable,
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
@@ -514,6 +521,7 @@ $("#btn-allocate").on('click', function() {
 | 
			
		||||
$('#btn-unallocate').on('click', function() {
 | 
			
		||||
    unallocateStock({{ build.id }}, {
 | 
			
		||||
        table: '#allocation-table-untracked',
 | 
			
		||||
        onSuccess: loadUntrackedStockTable,
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@@ -533,9 +541,7 @@ $('#allocate-selected-items').click(function() {
 | 
			
		||||
            {% if build.take_from %}
 | 
			
		||||
            source_location: {{ build.take_from.pk }},
 | 
			
		||||
            {% endif %}
 | 
			
		||||
            success: function(data) {
 | 
			
		||||
                $('#allocation-table-untracked').bootstrapTable('refresh');
 | 
			
		||||
            }
 | 
			
		||||
            success: loadUntrackedStockTable,
 | 
			
		||||
        }
 | 
			
		||||
    );
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -2270,7 +2270,9 @@ function autoAllocateStockToBuild(build_id, bom_items=[], options={}) {
 | 
			
		||||
        confirm: true,
 | 
			
		||||
        preFormContent: html,
 | 
			
		||||
        onSuccess: function(response) {
 | 
			
		||||
            $('#allocation-table-untracked').bootstrapTable('refresh');
 | 
			
		||||
            if (options.onSuccess) {
 | 
			
		||||
                options.onSuccess(response);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user