mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
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:
parent
8a3477a406
commit
1e55fc8b6d
@ -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
|
||||
|
||||
|
@ -35,6 +35,7 @@ class BuildFilter(rest_filters.FilterSet):
|
||||
'parent',
|
||||
'sales_order',
|
||||
'part',
|
||||
'issued_by',
|
||||
]
|
||||
|
||||
status = rest_filters.NumberFilter(label='Status')
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user