mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Search improvements (#3103)
* Allow part list API to be searched by SKU * Enable manufacturer parts and supplier parts search preview * Increment API version * Remove whitespace * Remove more whitespace
This commit is contained in:
parent
ccefefdc7f
commit
02607bd854
@ -4,11 +4,14 @@ InvenTree API version information
|
|||||||
|
|
||||||
|
|
||||||
# InvenTree API version
|
# InvenTree API version
|
||||||
INVENTREE_API_VERSION = 51
|
INVENTREE_API_VERSION = 52
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Increment this API version number whenever there is a significant change to the API that any clients need to know about
|
Increment this API version number whenever there is a significant change to the API that any clients need to know about
|
||||||
|
|
||||||
|
v52 -> 2022-05-31 : https://github.com/inventree/InvenTree/pull/3103
|
||||||
|
- Allow part list API to be searched by supplier SKU
|
||||||
|
|
||||||
v51 -> 2022-05-24 : https://github.com/inventree/InvenTree/pull/3058
|
v51 -> 2022-05-24 : https://github.com/inventree/InvenTree/pull/3058
|
||||||
- Adds new fields to the SalesOrderShipment model
|
- Adds new fields to the SalesOrderShipment model
|
||||||
|
|
||||||
|
@ -1425,6 +1425,20 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
|||||||
'validator': bool,
|
'validator': bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'SEARCH_PREVIEW_SHOW_SUPPLIER_PARTS': {
|
||||||
|
'name': _('Seach Supplier Parts'),
|
||||||
|
'description': _('Display supplier parts in search preview window'),
|
||||||
|
'default': True,
|
||||||
|
'validator': bool,
|
||||||
|
},
|
||||||
|
|
||||||
|
'SEARCH_PREVIEW_SHOW_MANUFACTURER_PARTS': {
|
||||||
|
'name': _('Search Manufacturer Parts'),
|
||||||
|
'description': _('Display manufacturer parts in search preview window'),
|
||||||
|
'default': True,
|
||||||
|
'validator': bool,
|
||||||
|
},
|
||||||
|
|
||||||
'SEARCH_HIDE_INACTIVE_PARTS': {
|
'SEARCH_HIDE_INACTIVE_PARTS': {
|
||||||
'name': _("Hide Inactive Parts"),
|
'name': _("Hide Inactive Parts"),
|
||||||
'description': _('Excluded inactive parts from search preview window'),
|
'description': _('Excluded inactive parts from search preview window'),
|
||||||
|
@ -1387,6 +1387,7 @@ class PartList(APIDownloadMixin, generics.ListCreateAPIView):
|
|||||||
'keywords',
|
'keywords',
|
||||||
'category__name',
|
'category__name',
|
||||||
'manufacturer_parts__MPN',
|
'manufacturer_parts__MPN',
|
||||||
|
'supplier_parts__SKU',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_PARTS" user_setting=True icon='fa-shapes' %}
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_PARTS" user_setting=True icon='fa-shapes' %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="SEARCH_HIDE_INACTIVE_PARTS" user_setting=True icon='fa-eye-slash' %}
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_HIDE_INACTIVE_PARTS" user_setting=True icon='fa-eye-slash' %}
|
||||||
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_SUPPLIER_PARTS" user_setting=True icon='fa-building' %}
|
||||||
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_MANUFACTURER_PARTS" user_setting=True icon='fa-industry' %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_CATEGORIES" user_setting=True icon='fa-sitemap' %}
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_CATEGORIES" user_setting=True icon='fa-sitemap' %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_STOCK" user_setting=True icon='fa-boxes' %}
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_STOCK" user_setting=True icon='fa-boxes' %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_HIDE_UNAVAILABLE_STOCK" user_setting=True icon='fa-eye-slash' %}
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_HIDE_UNAVAILABLE_STOCK" user_setting=True icon='fa-eye-slash' %}
|
||||||
|
@ -151,6 +151,46 @@ function updateSearch() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkPermission('part') && checkPermission('purchase_order')) {
|
||||||
|
|
||||||
|
var params = {
|
||||||
|
part_detail: true,
|
||||||
|
supplier_detail: true,
|
||||||
|
manufacturer_detail: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (user_settings.SEARCH_HIDE_INACTIVE_PARTS) {
|
||||||
|
// Return *only* active parts
|
||||||
|
params.active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user_settings.SEARCH_PREVIEW_SHOW_SUPPLIER_PARTS) {
|
||||||
|
addSearchQuery(
|
||||||
|
'supplierpart',
|
||||||
|
'{% trans "Supplier Parts" %}',
|
||||||
|
'{% url "api-supplier-part-list" %}',
|
||||||
|
params,
|
||||||
|
renderSupplierPart,
|
||||||
|
{
|
||||||
|
url: '/supplier-part',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user_settings.SEARCH_PREVIEW_SHOW_MANUFACTURER_PARTS) {
|
||||||
|
addSearchQuery(
|
||||||
|
'manufacturerpart',
|
||||||
|
'{% trans "Manufacturer Parts" %}',
|
||||||
|
'{% url "api-manufacturer-part-list" %}',
|
||||||
|
params,
|
||||||
|
renderManufacturerPart,
|
||||||
|
{
|
||||||
|
url: '/manufacturer-part',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (checkPermission('part_category') && user_settings.SEARCH_PREVIEW_SHOW_CATEGORIES) {
|
if (checkPermission('part_category') && user_settings.SEARCH_PREVIEW_SHOW_CATEGORIES) {
|
||||||
// Search for matching part categories
|
// Search for matching part categories
|
||||||
addSearchQuery(
|
addSearchQuery(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user