2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Child items table (#5114)

* Template cleanup

- Remove "buttons" attribute (outdated)

* Fix filters for "child stock items" table

* Fix 'ancestor' stock filter
This commit is contained in:
Oliver
2023-06-28 15:22:23 +10:00
committed by GitHub
parent 53e120cdb3
commit a78b26f93a
9 changed files with 29 additions and 47 deletions

View File

@ -1834,6 +1834,8 @@ function makeStockActions(table) {
*/
function loadStockTable(table, options) {
options.params = options.params || {};
// List of user-params which override the default filters
options.params['location_detail'] = true;
options.params['part_detail'] = true;
@ -1841,8 +1843,6 @@ function loadStockTable(table, options) {
// Determine if installed items are displayed in the table
let show_installed_items = global_settings.STOCK_SHOW_INSTALLED_ITEMS;
var params = options.params || {};
let filters = {};
if (!options.disableFilters) {
@ -1850,7 +1850,7 @@ function loadStockTable(table, options) {
const filterTarget = options.filterTarget || '#filter-list-stock';
const filterKey = options.filterKey || options.name || 'stock';
filters = loadTableFilters(filterKey, params);
filters = loadTableFilters(filterKey, options.params);
setupFilterList(filterKey, table, filterTarget, {
download: true,
@ -1886,7 +1886,7 @@ function loadStockTable(table, options) {
});
}
filters = Object.assign(filters, params);
filters = Object.assign(filters, options.params);
var col = null;
@ -1909,8 +1909,8 @@ function loadStockTable(table, options) {
field: 'part',
title: '{% trans "Part" %}',
sortName: 'part__name',
visible: params['part_detail'],
switchable: params['part_detail'],
visible: options.params['part_detail'],
switchable: options.params['part_detail'],
formatter: function(value, row) {
let html = '';
@ -1948,8 +1948,8 @@ function loadStockTable(table, options) {
field: 'IPN',
title: '{% trans "IPN" %}',
sortName: 'part__IPN',
visible: params['part_detail'],
switchable: params['part_detail'],
visible: options.params['part_detail'],
switchable: options.params['part_detail'],
formatter: function(value, row) {
var ipn = row.part_detail.IPN;
if (ipn) {
@ -1969,8 +1969,8 @@ function loadStockTable(table, options) {
columns.push({
field: 'part_detail.description',
title: '{% trans "Description" %}',
visible: params['part_detail'],
switchable: params['part_detail'],
visible: options.params['part_detail'],
switchable: options.params['part_detail'],
formatter: function(value, row) {
var description = row.part_detail.description;
return withTitle(shortenString(description), description);
@ -2168,8 +2168,8 @@ function loadStockTable(table, options) {
field: 'supplier_part',
title: '{% trans "Supplier Part" %}',
visible: params['supplier_part_detail'] || false,
switchable: params['supplier_part_detail'] || false,
visible: options.params['supplier_part_detail'] || false,
switchable: options.params['supplier_part_detail'] || false,
formatter: function(value, row) {
if (!value) {
return '-';
@ -2358,7 +2358,7 @@ function loadStockTable(table, options) {
queryParams: filters,
sidePagination: 'server',
name: 'stock',
original: params,
original: options.params,
showColumns: true,
showFooter: true,
columns: columns,