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,24 +431,32 @@ onPanelLoad('outputs', function() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
{% if build.active and build.has_untracked_bom_items %}
 | 
					{% if build.active and build.has_untracked_bom_items %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var build_info = {
 | 
					function loadUntrackedStockTable() {
 | 
				
			||||||
    pk: {{ build.pk }},
 | 
					
 | 
				
			||||||
    part: {{ build.part.pk }},
 | 
					    var build_info = {
 | 
				
			||||||
    quantity: {{ build.quantity }},
 | 
					        pk: {{ build.pk }},
 | 
				
			||||||
    {% if build.take_from %}
 | 
					        part: {{ build.part.pk }},
 | 
				
			||||||
    source_location: {{ build.take_from.pk }},
 | 
					        quantity: {{ build.quantity }},
 | 
				
			||||||
    {% endif %}
 | 
					        {% if build.take_from %}
 | 
				
			||||||
    tracked_parts: false,
 | 
					        source_location: {{ build.take_from.pk }},
 | 
				
			||||||
};
 | 
					        {% endif %}
 | 
				
			||||||
 | 
					        tracked_parts: false,
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    $('#allocation-table-untracked').bootstrapTable('destroy');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Load allocation table for un-tracked parts
 | 
				
			||||||
 | 
					    loadBuildOutputAllocationTable(
 | 
				
			||||||
 | 
					        build_info,
 | 
				
			||||||
 | 
					        null,
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            search: true,
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					loadUntrackedStockTable();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Load allocation table for un-tracked parts
 | 
					 | 
				
			||||||
loadBuildOutputAllocationTable(
 | 
					 | 
				
			||||||
    build_info,
 | 
					 | 
				
			||||||
    null,
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        search: true,
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
);
 | 
					 | 
				
			||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$('#btn-create-output').click(function() {
 | 
					$('#btn-create-output').click(function() {
 | 
				
			||||||
@@ -472,6 +480,7 @@ $("#btn-auto-allocate").on('click', function() {
 | 
				
			|||||||
            {% if build.take_from %}
 | 
					            {% if build.take_from %}
 | 
				
			||||||
            location: {{ build.take_from.pk }},
 | 
					            location: {{ build.take_from.pk }},
 | 
				
			||||||
            {% endif %}
 | 
					            {% endif %}
 | 
				
			||||||
 | 
					            onSuccess: loadUntrackedStockTable,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
@@ -503,9 +512,7 @@ $("#btn-allocate").on('click', function() {
 | 
				
			|||||||
                {% if build.take_from %}
 | 
					                {% if build.take_from %}
 | 
				
			||||||
                source_location: {{ build.take_from.pk }},
 | 
					                source_location: {{ build.take_from.pk }},
 | 
				
			||||||
                {% endif %}
 | 
					                {% endif %}
 | 
				
			||||||
                success: function(data) {
 | 
					                success: loadUntrackedStockTable,
 | 
				
			||||||
                    $('#allocation-table-untracked').bootstrapTable('refresh');
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -514,6 +521,7 @@ $("#btn-allocate").on('click', function() {
 | 
				
			|||||||
$('#btn-unallocate').on('click', function() {
 | 
					$('#btn-unallocate').on('click', function() {
 | 
				
			||||||
    unallocateStock({{ build.id }}, {
 | 
					    unallocateStock({{ build.id }}, {
 | 
				
			||||||
        table: '#allocation-table-untracked',
 | 
					        table: '#allocation-table-untracked',
 | 
				
			||||||
 | 
					        onSuccess: loadUntrackedStockTable,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -533,9 +541,7 @@ $('#allocate-selected-items').click(function() {
 | 
				
			|||||||
            {% if build.take_from %}
 | 
					            {% if build.take_from %}
 | 
				
			||||||
            source_location: {{ build.take_from.pk }},
 | 
					            source_location: {{ build.take_from.pk }},
 | 
				
			||||||
            {% endif %}
 | 
					            {% endif %}
 | 
				
			||||||
            success: function(data) {
 | 
					            success: loadUntrackedStockTable,
 | 
				
			||||||
                $('#allocation-table-untracked').bootstrapTable('refresh');
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2270,7 +2270,9 @@ function autoAllocateStockToBuild(build_id, bom_items=[], options={}) {
 | 
				
			|||||||
        confirm: true,
 | 
					        confirm: true,
 | 
				
			||||||
        preFormContent: html,
 | 
					        preFormContent: html,
 | 
				
			||||||
        onSuccess: function(response) {
 | 
					        onSuccess: function(response) {
 | 
				
			||||||
            $('#allocation-table-untracked').bootstrapTable('refresh');
 | 
					            if (options.onSuccess) {
 | 
				
			||||||
 | 
					                options.onSuccess(response);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user