2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-16 01:36:29 +00:00

Feature/location types (#5588)

* Added model changes for StockLocationTypes

* Implement icon for CUI

* Added location type to location table with filters

* Fix ruleset

* Added tests

* Bump api version to v136

* trigger: ci

* Bump api version variable too
This commit is contained in:
Lukas
2023-10-11 07:34:38 +02:00
committed by GitHub
parent 6f2dca729d
commit e8e0b57cea
13 changed files with 548 additions and 12 deletions

View File

@@ -81,6 +81,7 @@
serializeStockItem,
stockItemFields,
stockLocationFields,
stockLocationTypeFields,
uninstallStockItem,
*/
@@ -130,6 +131,20 @@ function serializeStockItem(pk, options={}) {
constructForm(url, options);
}
function stockLocationTypeFields() {
const fields = {
name: {},
description: {},
icon: {
help_text: `{% trans "Default icon for all locations that have no icon set (optional) - Explore all available icons on" %} <a href="https://fontawesome.com/v5/search?s=solid" target="_blank" rel="noopener noreferrer">Font Awesome</a>.`,
placeholder: 'fas fa-box',
icon: "fa-icons",
},
}
return fields;
}
function stockLocationFields(options={}) {
var fields = {
@@ -146,9 +161,20 @@ function stockLocationFields(options={}) {
owner: {},
structural: {},
external: {},
icon: {
location_type: {
secondary: {
title: '{% trans "Add Location type" %}',
fields: function() {
const fields = stockLocationTypeFields();
return fields;
}
},
},
custom_icon: {
help_text: `{% trans "Icon (optional) - Explore all available icons on" %} <a href="https://fontawesome.com/v5/search?s=solid" target="_blank" rel="noopener noreferrer">Font Awesome</a>.`,
placeholder: 'fas fa-box',
icon: "fa-icons",
},
};
@@ -2729,7 +2755,18 @@ function loadStockLocationTable(table, options) {
formatter: function(value) {
return yesNoLabel(value);
}
}
},
{
field: 'location_type',
title: '{% trans "Location type" %}',
switchable: true,
sortable: false,
formatter: function(value, row) {
if (row.location_type_detail) {
return row.location_type_detail.name;
}
}
},
]
});
}