Skip to content

Commit

Permalink
Issued by filter (#5515)
Browse files Browse the repository at this point in the history
* Construct dynamic user filter for issued-by

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

* Bump API version

* Fix API version
  • Loading branch information
SchrodingersGat authored Sep 7, 2023
1 parent 8a3477a commit 1e55fc8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion InvenTree/InvenTree/api_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions InvenTree/build/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Meta:
'parent',
'sales_order',
'part',
'issued_by',
]

status = rest_filters.NumberFilter(label='Status')
Expand Down
25 changes: 25 additions & 0 deletions InvenTree/templates/js/translated/table_filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -482,6 +506,7 @@ function getBuildTableFilters() {
return ownersList;
},
},
issued_by: constructIssuedByFilter(),
};

if (global_settings.PROJECT_CODES_ENABLED) {
Expand Down

0 comments on commit 1e55fc8

Please sign in to comment.