mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Add ProjectCode support to build orders (#4808)
* Add "project_code" field to Build model * Add "project_code" field to Build model * build javascript updates (cherry picked from commit3e27a3b739
) * Update table filters (cherry picked from commit196c675585
) * Adds API filtering * Bump API version * Hide project code field from build form if project codes not enabled (cherry picked from commit4e210e3dfa
) * refactoring to attempt to fix circular imports * Upgrade django-test-migrations package * Fix broken import * Further fixes for unit tests * Update unit tests for migration files * Fix typo in build.js * Migration test updates - Need to specify MPTT stuff * Fix build.js * Fix migration order * Update API version
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
FullCalendar,
|
||||
getFormFieldValue,
|
||||
getTableData,
|
||||
global_settings,
|
||||
handleFormErrors,
|
||||
handleFormSuccess,
|
||||
imageHoverIcon,
|
||||
@ -64,7 +65,7 @@
|
||||
|
||||
|
||||
function buildFormFields() {
|
||||
return {
|
||||
let fields = {
|
||||
reference: {
|
||||
icon: 'fa-hashtag',
|
||||
},
|
||||
@ -76,6 +77,9 @@ function buildFormFields() {
|
||||
},
|
||||
title: {},
|
||||
quantity: {},
|
||||
project_code: {
|
||||
icon: 'fa-list',
|
||||
},
|
||||
priority: {},
|
||||
parent: {
|
||||
filters: {
|
||||
@ -111,6 +115,12 @@ function buildFormFields() {
|
||||
icon: 'fa-users',
|
||||
},
|
||||
};
|
||||
|
||||
if (!global_settings.PROJECT_CODES_ENABLED) {
|
||||
delete fields.project_code;
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2020,6 +2030,18 @@ function loadBuildTable(table, options) {
|
||||
title: '{% trans "Description" %}',
|
||||
switchable: true,
|
||||
},
|
||||
{
|
||||
field: 'project_code',
|
||||
title: '{% trans "Project Code" %}',
|
||||
sortable: true,
|
||||
switchable: global_settings.PROJECT_CODES_ENABLED,
|
||||
visible: global_settings.PROJECT_CODES_ENABLED,
|
||||
formatter: function(value, row) {
|
||||
if (row.project_code_detail) {
|
||||
return `<span title='${row.project_code_detail.description}'>${row.project_code_detail.code}</span>`;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'priority',
|
||||
title: '{% trans "Priority" %}',
|
||||
|
@ -440,7 +440,7 @@ function getPluginTableFilters() {
|
||||
// Return a dictionary of filters for the "build" table
|
||||
function getBuildTableFilters() {
|
||||
|
||||
return {
|
||||
let filters = {
|
||||
status: {
|
||||
title: '{% trans "Build status" %}',
|
||||
options: buildCodes,
|
||||
@ -477,6 +477,13 @@ function getBuildTableFilters() {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
if (global_settings.PROJECT_CODES_ENABLED) {
|
||||
filters['has_project_code'] = constructHasProjectCodeFilter();
|
||||
filters['project_code'] = constructProjectCodeFilter();
|
||||
}
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user