mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Add extra options to control search results in preview window
- Allow user to optionally show / hide inactive purchase orders - Allow user to optionally show / hide inactive sales orders
This commit is contained in:
parent
c9d4268c34
commit
8ad141f910
@ -1464,6 +1464,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
|||||||
'validator': bool,
|
'validator': bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'SEARCH_PREVIEW_EXCLUDE_INACTIVE_PURCHASE_ORDERS': {
|
||||||
|
'name': _('Exclude Inactive Purchase Orders'),
|
||||||
|
'description': _('Exclude inactive purchase orders from search preview window'),
|
||||||
|
'default': True,
|
||||||
|
'validator': bool,
|
||||||
|
},
|
||||||
|
|
||||||
'SEARCH_PREVIEW_SHOW_SALES_ORDERS': {
|
'SEARCH_PREVIEW_SHOW_SALES_ORDERS': {
|
||||||
'name': _('Search Sales Orders'),
|
'name': _('Search Sales Orders'),
|
||||||
'description': _('Display sales orders in search preview window'),
|
'description': _('Display sales orders in search preview window'),
|
||||||
@ -1471,6 +1478,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
|||||||
'validator': bool,
|
'validator': bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'SEARCH_PREVIEW_EXCLUDE_INACTIVE_SALES_ORDERS': {
|
||||||
|
'name': 'Exclude Inactive Sales Orders',
|
||||||
|
'description': _('Exclude inactive sales orders from search preview window'),
|
||||||
|
'validator': bool,
|
||||||
|
'default': True,
|
||||||
|
},
|
||||||
|
|
||||||
'SEARCH_PREVIEW_RESULTS': {
|
'SEARCH_PREVIEW_RESULTS': {
|
||||||
'name': _('Search Preview Results'),
|
'name': _('Search Preview Results'),
|
||||||
'description': _('Number of results to show in each section of the search preview window'),
|
'description': _('Number of results to show in each section of the search preview window'),
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_LOCATIONS" user_setting=True icon='fa-sitemap' %}
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_LOCATIONS" user_setting=True icon='fa-sitemap' %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_COMPANIES" user_setting=True icon='fa-building' %}
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_COMPANIES" user_setting=True icon='fa-building' %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_PURCHASE_ORDERS" user_setting=True icon='fa-shopping-cart' %}
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_PURCHASE_ORDERS" user_setting=True icon='fa-shopping-cart' %}
|
||||||
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_EXCLUDE_INACTIVE_PURCHASE_ORDERS" user_setting=True icon='fa-search-minus' %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_SALES_ORDERS" user_setting=True icon='fa-truck' %}
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_SALES_ORDERS" user_setting=True icon='fa-truck' %}
|
||||||
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_EXCLUDE_INACTIVE_SALES_ORDERS" user_setting=True icon='fa-search-minus' %}
|
||||||
|
|
||||||
{% 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' %}
|
||||||
|
|
||||||
|
@ -167,15 +167,23 @@ function updateSearch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (user_settings.SEARCH_PREVIEW_SHOW_PURCHASE_ORDERS) {
|
if (user_settings.SEARCH_PREVIEW_SHOW_PURCHASE_ORDERS) {
|
||||||
|
|
||||||
|
var filters = {
|
||||||
|
supplier_detail: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user_settings.SEARCH_PREVIEW_EXCLUDE_INACTIVE_PURCHASE_ORDERS) {
|
||||||
|
var filters = {
|
||||||
|
outstanding: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Search for matching purchase orders
|
// Search for matching purchase orders
|
||||||
addSearchQuery(
|
addSearchQuery(
|
||||||
'purchaseorder',
|
'purchaseorder',
|
||||||
'{% trans "Purchase Orders" %}',
|
'{% trans "Purchase Orders" %}',
|
||||||
'{% url "api-po-list" %}',
|
'{% url "api-po-list" %}',
|
||||||
{
|
filters,
|
||||||
supplier_detail: true,
|
|
||||||
outstanding: true,
|
|
||||||
},
|
|
||||||
renderPurchaseOrder,
|
renderPurchaseOrder,
|
||||||
{
|
{
|
||||||
url: '/order/purchase-order',
|
url: '/order/purchase-order',
|
||||||
@ -184,15 +192,22 @@ function updateSearch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (user_settings.SEARCH_PREVIEW_SHOW_SALES_ORDERS) {
|
if (user_settings.SEARCH_PREVIEW_SHOW_SALES_ORDERS) {
|
||||||
|
|
||||||
|
var filters = {
|
||||||
|
customer_detail: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Hide inactive (not "outstanding" orders)
|
||||||
|
if (user_settings.SEARCH_PREVIEW_EXCLUDE_INACTIVE_SALES_ORDERS) {
|
||||||
|
filters.outstanding = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Search for matching sales orders
|
// Search for matching sales orders
|
||||||
addSearchQuery(
|
addSearchQuery(
|
||||||
'salesorder',
|
'salesorder',
|
||||||
'{% trans "Sales Orders" %}',
|
'{% trans "Sales Orders" %}',
|
||||||
'{% url "api-so-list" %}',
|
'{% url "api-so-list" %}',
|
||||||
{
|
filters,
|
||||||
customer_detail: true,
|
|
||||||
outstanding: true,
|
|
||||||
},
|
|
||||||
renderSalesOrder,
|
renderSalesOrder,
|
||||||
{
|
{
|
||||||
url: '/order/sales-order',
|
url: '/order/sales-order',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user