Merge branch 'master' of https://github.com/inventree/InvenTree into plugin-2037

This commit is contained in:
Matthias 2021-11-04 14:23:17 +01:00
commit 0daba629fe
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
4 changed files with 22 additions and 5 deletions

View File

@ -563,6 +563,7 @@
.search-autocomplete-item { .search-autocomplete-item {
border-top: 1px solid #EEE; border-top: 1px solid #EEE;
margin-bottom: 2px; margin-bottom: 2px;
overflow-x: hidden;
} }
.modal { .modal {

View File

@ -131,13 +131,21 @@ function inventreeDocReady() {
if ($('#search-bar').exists()) { if ($('#search-bar').exists()) {
$('#search-bar').autocomplete({ $('#search-bar').autocomplete({
source: function(request, response) { source: function(request, response) {
$.ajax({
url: '/api/part/', var params = {
data: {
search: request.term, search: request.term,
limit: user_settings.SEARCH_PREVIEW_RESULTS, limit: user_settings.SEARCH_PREVIEW_RESULTS,
offset: 0 offset: 0,
}, };
if (user_settings.SEARCH_HIDE_INACTIVE_PARTS) {
// Limit to active parts
params.active = true;
}
$.ajax({
url: '/api/part/',
data: params,
success: function(data) { success: function(data) {
var transformed = $.map(data.results, function(el) { var transformed = $.map(data.results, function(el) {

View File

@ -1059,6 +1059,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
'validator': bool, 'validator': bool,
}, },
'SEARCH_HIDE_INACTIVE_PARTS': {
'name': _("Hide Inactive Parts"),
'description': _('Hide inactive parts in search preview window'),
'default': False,
'validator': bool,
},
'PART_SHOW_QUANTITY_IN_FORMS': { 'PART_SHOW_QUANTITY_IN_FORMS': {
'name': _('Show Quantity in Forms'), 'name': _('Show Quantity in Forms'),
'description': _('Display available part quantity in some forms'), 'description': _('Display available part quantity in some forms'),

View File

@ -16,6 +16,7 @@
<tbody> <tbody>
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_RESULTS" user_setting=True icon='fa-search' %} {% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_RESULTS" user_setting=True icon='fa-search' %}
{% include "InvenTree/settings/setting.html" with key="SEARCH_SHOW_STOCK_LEVELS" user_setting=True icon='fa-boxes' %} {% include "InvenTree/settings/setting.html" with key="SEARCH_SHOW_STOCK_LEVELS" user_setting=True icon='fa-boxes' %}
{% include "InvenTree/settings/setting.html" with key="SEARCH_HIDE_INACTIVE_PARTS" user_setting=True icon='fa-eye-slash' %}
</tbody> </tbody>
</table> </table>
</div> </div>