2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 20:46:47 +00:00

Reload the untracked stock table when allocation actions are performed

This commit is contained in:
Oliver 2022-04-29 12:59:20 +10:00
parent 51da1f02a8
commit 8fc34a21a6
2 changed files with 32 additions and 24 deletions

View File

@ -431,6 +431,8 @@ onPanelLoad('outputs', function() {
{% if build.active and build.has_untracked_bom_items %} {% if build.active and build.has_untracked_bom_items %}
function loadUntrackedStockTable() {
var build_info = { var build_info = {
pk: {{ build.pk }}, pk: {{ build.pk }},
part: {{ build.part.pk }}, part: {{ build.part.pk }},
@ -441,6 +443,8 @@ var build_info = {
tracked_parts: false, tracked_parts: false,
}; };
$('#allocation-table-untracked').bootstrapTable('destroy');
// Load allocation table for un-tracked parts // Load allocation table for un-tracked parts
loadBuildOutputAllocationTable( loadBuildOutputAllocationTable(
build_info, build_info,
@ -449,6 +453,10 @@ loadBuildOutputAllocationTable(
search: true, search: true,
} }
); );
}
loadUntrackedStockTable();
{% 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');
}
} }
); );
}); });

View File

@ -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);
}
} }
}); });
} }