mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 12:36:45 +00:00
Bug fix for stock location table
(cherry picked from commit 44794d7b78520023e3b70da61dc13938bfd4bd14)
This commit is contained in:
parent
08719d4d1b
commit
c4ea3ecf6f
@ -183,7 +183,8 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
parent: 'null',
|
parent: 'null',
|
||||||
{% endif %}
|
{% endif %}
|
||||||
}
|
},
|
||||||
|
allowTreeView: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
linkButtonsToSelection(
|
linkButtonsToSelection(
|
||||||
|
@ -1416,8 +1416,11 @@ function loadStockTable(table, options) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Display a table of stock locations
|
||||||
|
*/
|
||||||
function loadStockLocationTable(table, options) {
|
function loadStockLocationTable(table, options) {
|
||||||
/* Display a table of stock locations */
|
|
||||||
|
|
||||||
var params = options.params || {};
|
var params = options.params || {};
|
||||||
|
|
||||||
@ -1443,15 +1446,15 @@ function loadStockLocationTable(table, options) {
|
|||||||
filters[key] = params[key];
|
filters[key] = params[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
var tree_view = inventreeLoad('location-tree-view') == 1;
|
var tree_view = options.allowTreeView && inventreeLoad('location-tree-view') == 1;
|
||||||
|
|
||||||
table.inventreeTable({
|
table.inventreeTable({
|
||||||
treeEnable: tree_view,
|
treeEnable: options.allowTreeView && tree_view,
|
||||||
rootParentId: options.params.parent,
|
rootParentId: options.params.parent,
|
||||||
uniqueId: 'pk',
|
uniqueId: 'pk',
|
||||||
idField: 'pk',
|
idField: 'pk',
|
||||||
treeShowField: 'name',
|
treeShowField: 'name',
|
||||||
parentIdField: 'parent',
|
parentIdField: tree_view ? 'parent' : null,
|
||||||
disablePagination: tree_view,
|
disablePagination: tree_view,
|
||||||
sidePagination: tree_view ? 'client' : 'server',
|
sidePagination: tree_view ? 'client' : 'server',
|
||||||
serverSort: !tree_view,
|
serverSort: !tree_view,
|
||||||
@ -1465,6 +1468,8 @@ function loadStockLocationTable(table, options) {
|
|||||||
showColumns: true,
|
showColumns: true,
|
||||||
onPostBody: function() {
|
onPostBody: function() {
|
||||||
|
|
||||||
|
if (options.allowTreeView) {
|
||||||
|
|
||||||
tree_view = inventreeLoad('location-tree-view') == 1;
|
tree_view = inventreeLoad('location-tree-view') == 1;
|
||||||
|
|
||||||
if (tree_view) {
|
if (tree_view) {
|
||||||
@ -1485,8 +1490,9 @@ function loadStockLocationTable(table, options) {
|
|||||||
$('#view-location-tree').removeClass('btn-secondary').addClass('btn-outline-secondary');
|
$('#view-location-tree').removeClass('btn-secondary').addClass('btn-outline-secondary');
|
||||||
$('#view-location-list').removeClass('btn-outline-secondary').addClass('btn-secondary');
|
$('#view-location-list').removeClass('btn-outline-secondary').addClass('btn-secondary');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
buttons: [
|
buttons: options.allowTreeView ? [
|
||||||
{
|
{
|
||||||
icon: 'fas fa-bars',
|
icon: 'fas fa-bars',
|
||||||
attributes: {
|
attributes: {
|
||||||
@ -1525,7 +1531,7 @@ function loadStockLocationTable(table, options) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
] : [],
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
checkbox: true,
|
checkbox: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user