mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Merge pull request #2177 from SchrodingersGat/quick-search
Add a per-user setting to enable display of stock in search results
This commit is contained in:
		| @@ -998,6 +998,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): | |||||||
|             'validator': [int, MinValueValidator(1)] |             'validator': [int, MinValueValidator(1)] | ||||||
|         }, |         }, | ||||||
|  |  | ||||||
|  |         'SEARCH_SHOW_STOCK_LEVELS': { | ||||||
|  |             'name': _('Search Show Stock'), | ||||||
|  |             'description': _('Display stock levels in search preview window'), | ||||||
|  |             'default': True, | ||||||
|  |             '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'), | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ | |||||||
|         {% include "InvenTree/settings/header.html" %} |         {% include "InvenTree/settings/header.html" %} | ||||||
|         <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' %} | ||||||
|         </tbody> |         </tbody> | ||||||
|     </table> |     </table> | ||||||
| </div> | </div> | ||||||
|   | |||||||
| @@ -168,12 +168,14 @@ function inventreeDocReady() { | |||||||
|  |  | ||||||
|                 html += '</span>'; |                 html += '</span>'; | ||||||
|                  |                  | ||||||
|  |                 if (user_settings.SEARCH_SHOW_STOCK_LEVELS) { | ||||||
|                     html += partStockLabel( |                     html += partStockLabel( | ||||||
|                         item.data, |                         item.data, | ||||||
|                         { |                         { | ||||||
|                             label_class: 'label-right', |                             label_class: 'label-right', | ||||||
|                         } |                         } | ||||||
|                     ); |                     ); | ||||||
|  |                 } | ||||||
|  |  | ||||||
|                 html += '</a>'; |                 html += '</a>'; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user