Issued by filter (#5515)

* Construct dynamic user filter for issued-by

* Allow "build order" table to be filtered by "issued_by" field

* Bump API version

* Fix API version
This commit is contained in:
Oliver 2023-09-08 09:10:42 +10:00 committed by GitHub
parent 8a3477a406
commit 1e55fc8b6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 1 deletions

View File

@ -2,11 +2,14 @@
# InvenTree API version
INVENTREE_API_VERSION = 131
INVENTREE_API_VERSION = 132
"""
Increment this API version number whenever there is a significant change to the API that any clients need to know about
v132 -> 2023-09-07 : https://github.com/inventree/InvenTree/pull/5515
- Add 'issued_by' filter to BuildOrder API list endpoint
v131 -> 2023-08-09 : https://github.com/inventree/InvenTree/pull/5415
- Annotate 'available_variant_stock' to the SalesOrderLine serializer

View File

@ -35,6 +35,7 @@ class BuildFilter(rest_filters.FilterSet):
'parent',
'sales_order',
'part',
'issued_by',
]
status = rest_filters.NumberFilter(label='Status')

View File

@ -18,6 +18,30 @@
*/
// Construct a dynamic API filter for the "issued by" field
function constructIssuedByFilter() {
return {
title: '{% trans "Issued By" %}',
options: function() {
let users = {};
inventreeGet('{% url "api-user-list" %}', {}, {
async: false,
success: function(response) {
for (let user of response) {
users[user.pk] = {
key: user.pk,
value: user.username
};
}
}
});
return users;
}
}
}
// Construct a dynamic API filter for the "project" field
function constructProjectCodeFilter() {
return {
@ -482,6 +506,7 @@ function getBuildTableFilters() {
return ownersList;
},
},
issued_by: constructIssuedByFilter(),
};
if (global_settings.PROJECT_CODES_ENABLED) {