mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix table_filters.js
This commit is contained in:
parent
a222efda33
commit
28bf5bfdbc
@ -85,7 +85,7 @@ class BaseInvenTreeSetting(models.Model):
|
|||||||
|
|
||||||
# Convert to javascript compatible booleans
|
# Convert to javascript compatible booleans
|
||||||
if cls.validator_is_bool(validator):
|
if cls.validator_is_bool(validator):
|
||||||
value = 'true' if value else 'false'
|
value = value.lower()
|
||||||
|
|
||||||
# Numerical values remain the same
|
# Numerical values remain the same
|
||||||
elif cls.validator_is_int(validator):
|
elif cls.validator_is_int(validator):
|
||||||
|
@ -121,7 +121,8 @@ function getAvailableTableFilters(tableKey) {
|
|||||||
|
|
||||||
// Filters for the "Stock" table
|
// Filters for the "Stock" table
|
||||||
if (tableKey == 'stock') {
|
if (tableKey == 'stock') {
|
||||||
return {
|
|
||||||
|
var filters = {
|
||||||
active: {
|
active: {
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
title: '{% trans "Active parts" %}',
|
title: '{% trans "Active parts" %}',
|
||||||
@ -147,20 +148,6 @@ function getAvailableTableFilters(tableKey) {
|
|||||||
title: '{% trans "Depleted" %}',
|
title: '{% trans "Depleted" %}',
|
||||||
description: '{% trans "Show stock items which are depleted" %}',
|
description: '{% trans "Show stock items which are depleted" %}',
|
||||||
},
|
},
|
||||||
|
|
||||||
{% settings_value "STOCK_ENABLE_EXPIRY" as expiry %}
|
|
||||||
{% if expiry %}
|
|
||||||
expired: {
|
|
||||||
type: 'bool',
|
|
||||||
title: '{% trans "Expired" %}',
|
|
||||||
description: '{% trans "Show stock items which have expired" %}',
|
|
||||||
},
|
|
||||||
stale: {
|
|
||||||
type: 'bool',
|
|
||||||
title: '{% trans "Stale" %}',
|
|
||||||
description: '{% trans "Show stock which is close to expiring" %}',
|
|
||||||
},
|
|
||||||
{% endif %}
|
|
||||||
in_stock: {
|
in_stock: {
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
title: '{% trans "In Stock" %}',
|
title: '{% trans "In Stock" %}',
|
||||||
@ -217,6 +204,23 @@ function getAvailableTableFilters(tableKey) {
|
|||||||
description: '{% trans "Show stock items which have a purchase price set" %}',
|
description: '{% trans "Show stock items which have a purchase price set" %}',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Optional filters if stock expiry functionality is enabled
|
||||||
|
if (global_settings.STOCK_ENABLE_EXPIRY) {
|
||||||
|
filters.expired = {
|
||||||
|
type: 'bool',
|
||||||
|
title: '{% trans "Expired" %}',
|
||||||
|
description: '{% trans "Show stock items which have expired" %}',
|
||||||
|
};
|
||||||
|
|
||||||
|
filters.stale = {
|
||||||
|
type: 'bool',
|
||||||
|
title: '{% trans "Stale" %}',
|
||||||
|
description: '{% trans "Show stock which is close to expiring" %}',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filters for the 'stock test' table
|
// Filters for the 'stock test' table
|
||||||
|
Loading…
Reference in New Issue
Block a user