From f1553337f73a1b46e1f3ad42c258933d576388d7 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 May 2022 00:15:25 +0200 Subject: [PATCH 01/15] add pre-commit --- .pre-commit-config.yaml | 11 +++++++++++ requirements.txt | 1 + tasks.py | 15 ++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..0e8a58ece0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: mixed-line-ending diff --git a/requirements.txt b/requirements.txt index 5065b4f877..2a4f557e3b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -39,6 +39,7 @@ inventree # Install the latest version of the Inve markdown==3.3.4 # Force particular version of markdown pep8-naming==0.11.1 # PEP naming convention extension pillow==9.0.1 # Image manipulation +pre-commit==2.19.0 # Git pre-commit py-moneyed==0.8.0 # Specific version requirement for py-moneyed pygments==2.7.4 # Syntax highlighting python-barcode[images]==0.13.1 # Barcode generator diff --git a/tasks.py b/tasks.py index 2ed0b4d35e..db3a68d503 100644 --- a/tasks.py +++ b/tasks.py @@ -98,6 +98,19 @@ def install(c): # Install required Python packages with PIP c.run('pip3 install -U -r requirements.txt') +def setup_dev(c): + """ + Sets up everything needed for the dev enviroment + """ + + print("Installing required python packages from 'requirements.txt'") + + # Install required Python packages with PIP + c.run('pip3 install -U -r requirements.txt') + + # Install pre-commit hook + c.run('pre-commit install') + @task def shell(c): """ @@ -253,7 +266,7 @@ def update(c): - static - clean_settings """ - + # Recompile the translation files (.mo) # We do not run 'invoke translate' here, as that will touch the source (.po) files too! manage(c, 'compilemessages', pty=True) From a67a6c55c28bddc413659c13b6121679a806e636 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 May 2022 00:19:03 +0200 Subject: [PATCH 02/15] declare as task --- tasks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks.py b/tasks.py index db3a68d503..4a5c7b8c65 100644 --- a/tasks.py +++ b/tasks.py @@ -98,6 +98,7 @@ def install(c): # Install required Python packages with PIP c.run('pip3 install -U -r requirements.txt') +@task def setup_dev(c): """ Sets up everything needed for the dev enviroment From cc2081bf504b79646ce8d129b4b42220dfcbf1d1 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 May 2022 00:19:37 +0200 Subject: [PATCH 03/15] add hook auto-update to setup --- tasks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasks.py b/tasks.py index 4a5c7b8c65..e0c6f8d018 100644 --- a/tasks.py +++ b/tasks.py @@ -112,6 +112,9 @@ def setup_dev(c): # Install pre-commit hook c.run('pre-commit install') + # Update all the hooks + c.run('pre-commit autoupdate') + @task def shell(c): """ From 55ee0836f8dccb7b9f3010a0b6f344cf30b5a285 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 May 2022 00:20:07 +0200 Subject: [PATCH 04/15] add flake8 to the hooks --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0e8a58ece0..fa65238f9a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,3 +9,8 @@ repos: - id: check-yaml - id: check-added-large-files - id: mixed-line-ending +- repo: https://github.com/pycqa/flake8 + rev: '4.0.1' + hooks: + - id: flake8 + additional_dependencies: [flake8-docstrings] From 552622fb475ce7b163008cf7d80e2b6929045cb0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 May 2022 00:21:35 +0200 Subject: [PATCH 05/15] remove docstring tests --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa65238f9a..48e530b22b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,4 +13,3 @@ repos: rev: '4.0.1' hooks: - id: flake8 - additional_dependencies: [flake8-docstrings] From c5db595b54f8e1fe8ab6fae7f6836562fdf24036 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 May 2022 01:13:04 +0200 Subject: [PATCH 06/15] add isort --- .pre-commit-config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48e530b22b..1dc2ba3f70 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,3 +13,7 @@ repos: rev: '4.0.1' hooks: - id: flake8 +- repo: https://github.com/pycqa/isort + rev: '5.10.1' + hooks: + - id: isort From a07fdb7c16d1df4838b3ca15301e37ae5923e68a Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 May 2022 01:18:55 +0200 Subject: [PATCH 07/15] add docstring comment --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c36c11b62b..12e6b6674b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -90,7 +90,8 @@ The various github actions can be found in the `./github/workflows` directory ## Code Style -Sumbitted Python code is automatically checked against PEP style guidelines. Locally you can run `invoke style` to ensure the style checks will pass, before submitting the PR. +Sumbitted Python code is automatically checked against PEP style guidelines. Locally you can run `invoke style` to ensure the style checks will pass, before submitting the PR. +Please write docstrings for each function and class - we follow the [google doc-style](https://google.github.io/styleguide/pyguide.html#244-decision) for python. Docstrings for general javascript code is encouraged! Docstyles are checked by `invoke style`. ## Documentation From da36af2021340da5c43b96f74b0ba1530bd48a80 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 May 2022 01:19:07 +0200 Subject: [PATCH 08/15] fix link --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 12e6b6674b..bff9dda73c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -91,7 +91,7 @@ The various github actions can be found in the `./github/workflows` directory ## Code Style Sumbitted Python code is automatically checked against PEP style guidelines. Locally you can run `invoke style` to ensure the style checks will pass, before submitting the PR. -Please write docstrings for each function and class - we follow the [google doc-style](https://google.github.io/styleguide/pyguide.html#244-decision) for python. Docstrings for general javascript code is encouraged! Docstyles are checked by `invoke style`. +Please write docstrings for each function and class - we follow the [google doc-style](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) for python. Docstrings for general javascript code is encouraged! Docstyles are checked by `invoke style`. ## Documentation From 545756eacb626447be8a3e687b51f4b4c4e025c6 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 May 2022 01:20:04 +0200 Subject: [PATCH 09/15] add docstring testing --- requirements.txt | 1 + setup.cfg | 3 +++ 2 files changed, 4 insertions(+) diff --git a/requirements.txt b/requirements.txt index 2a4f557e3b..ee6899e92b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,6 +33,7 @@ django-weasyprint==1.0.1 # django weasyprint integration djangorestframework==3.12.4 # DRF framework django-xforwardedfor-middleware==2.0 # IP forwarding metadata flake8==3.8.3 # PEP checking +flake8-docstrings==1.6.0 # docstring format testing gunicorn>=20.1.0 # Gunicorn web server importlib_metadata # Backport for importlib.metadata inventree # Install the latest version of the InvenTree API python library diff --git a/setup.cfg b/setup.cfg index b4b0af8836..f57040d151 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,8 +15,11 @@ ignore = N806, # - N812 - lowercase imported as non-lowercase N812, + # - D415 - First line should end with a period, question mark, or exclamation point + D415, exclude = .git,__pycache__,*/migrations/*,*/lib/*,*/bin/*,*/media/*,*/static/* max-complexity = 20 +docstring-convention=google [coverage:run] source = ./InvenTree From f98ec6cf3515b8d0dcacba9502de3aa1f408506f Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Thu, 19 May 2022 01:34:39 +0200 Subject: [PATCH 10/15] Add pre-commit comment --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bff9dda73c..e6a58dba54 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,9 @@ Please read the contribution guidelines below, before submitting your first pull request to the InvenTree codebase. +## Setup + +Please run `invoke setup_dev` in the root directory of your InvenTree code base to set up your development setup before starting to contribute. This will install and set up pre-commit to run some checks before each commit and help reduce the style errors. + ## Branches and Versioning InvenTree roughly follow the [GitLab flow](https://docs.gitlab.com/ee/topics/gitlab_flow.html) branching style, to allow simple management of multiple tagged releases, short-lived branches, and development on the main branch. From 8ad141f910ba86570c29cd31d854c3807f4af381 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 20 May 2022 16:57:30 +1000 Subject: [PATCH 11/15] 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 --- InvenTree/common/models.py | 14 +++++++++ .../InvenTree/settings/user_search.html | 2 ++ InvenTree/templates/js/translated/search.js | 31 ++++++++++++++----- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 92e5c1522c..a9150a8e6d 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -1464,6 +1464,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): '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': { 'name': _('Search Sales Orders'), 'description': _('Display sales orders in search preview window'), @@ -1471,6 +1478,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): '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': { 'name': _('Search Preview Results'), 'description': _('Number of results to show in each section of the search preview window'), diff --git a/InvenTree/templates/InvenTree/settings/user_search.html b/InvenTree/templates/InvenTree/settings/user_search.html index 1883110b80..97ce2bb7e9 100644 --- a/InvenTree/templates/InvenTree/settings/user_search.html +++ b/InvenTree/templates/InvenTree/settings/user_search.html @@ -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_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_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_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' %} diff --git a/InvenTree/templates/js/translated/search.js b/InvenTree/templates/js/translated/search.js index 4db310a062..8ba54a5dd1 100644 --- a/InvenTree/templates/js/translated/search.js +++ b/InvenTree/templates/js/translated/search.js @@ -167,15 +167,23 @@ function updateSearch() { } 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 addSearchQuery( 'purchaseorder', '{% trans "Purchase Orders" %}', '{% url "api-po-list" %}', - { - supplier_detail: true, - outstanding: true, - }, + filters, renderPurchaseOrder, { url: '/order/purchase-order', @@ -184,15 +192,22 @@ function updateSearch() { } 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 addSearchQuery( 'salesorder', '{% trans "Sales Orders" %}', '{% url "api-so-list" %}', - { - customer_detail: true, - outstanding: true, - }, + filters, renderSalesOrder, { url: '/order/sales-order', From 0f4ed55bed1985640fee115b14ad57c6e2a6f74c Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 20 May 2022 17:02:28 +1000 Subject: [PATCH 12/15] JS fixes --- InvenTree/templates/InvenTree/settings/user_search.html | 6 +++--- InvenTree/templates/js/translated/search.js | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/InvenTree/templates/InvenTree/settings/user_search.html b/InvenTree/templates/InvenTree/settings/user_search.html index 97ce2bb7e9..f54c5fd2ef 100644 --- a/InvenTree/templates/InvenTree/settings/user_search.html +++ b/InvenTree/templates/InvenTree/settings/user_search.html @@ -15,18 +15,18 @@ {% 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_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_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_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_EXCLUDE_INACTIVE_PURCHASE_ORDERS" user_setting=True icon='fa-eye-slash' %} {% 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_EXCLUDE_INACTIVE_SALES_ORDERS" user_setting=True icon='fa-eye-slash' %} {% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_RESULTS" user_setting=True icon='fa-search' %} - {% include "InvenTree/settings/setting.html" with key="SEARCH_HIDE_INACTIVE_PARTS" user_setting=True icon='fa-eye-slash' %}
diff --git a/InvenTree/templates/js/translated/search.js b/InvenTree/templates/js/translated/search.js index 8ba54a5dd1..5900a9b28d 100644 --- a/InvenTree/templates/js/translated/search.js +++ b/InvenTree/templates/js/translated/search.js @@ -170,12 +170,10 @@ function updateSearch() { var filters = { supplier_detail: true, - } + }; if (user_settings.SEARCH_PREVIEW_EXCLUDE_INACTIVE_PURCHASE_ORDERS) { - var filters = { - outstanding: true, - } + filters.outstanding = true; } // Search for matching purchase orders From 8da278a0721743b6e2b1eb80f45acb966bac4be3 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 20 May 2022 17:10:51 +1000 Subject: [PATCH 13/15] Adds option to hide unavailable stock items from the search preview window --- InvenTree/common/models.py | 23 ++++++++++++------- .../InvenTree/settings/user_search.html | 1 + InvenTree/templates/js/translated/search.js | 16 +++++++++---- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index a9150a8e6d..2beeb26f1d 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -1428,6 +1428,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): 'default': True, 'validator': bool, }, + + 'SEARCH_HIDE_INACTIVE_PARTS': { + 'name': _("Hide Inactive Parts"), + 'description': _('Excluded inactive parts from search preview window'), + 'default': False, + 'validator': bool, + }, 'SEARCH_PREVIEW_SHOW_CATEGORIES': { 'name': _('Search Categories'), @@ -1443,6 +1450,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): 'validator': bool, }, + 'SEARCH_PREVIEW_HIDE_UNAVAILABLE_STOCK': { + 'name': _('Hide Unavailable Stock Items'), + 'description': _('Exclude stock items which are not available from the search preview window'), + 'validator': bool, + 'default': False, + }, + 'SEARCH_PREVIEW_SHOW_LOCATIONS': { 'name': _('Search Locations'), 'description': _('Display stock locations in search preview window'), @@ -1479,7 +1493,7 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): }, 'SEARCH_PREVIEW_EXCLUDE_INACTIVE_SALES_ORDERS': { - 'name': 'Exclude Inactive Sales Orders', + 'name': _('Exclude Inactive Sales Orders'), 'description': _('Exclude inactive sales orders from search preview window'), 'validator': bool, 'default': True, @@ -1492,13 +1506,6 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): 'validator': [int, MinValueValidator(1)] }, - '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': { 'name': _('Show Quantity in Forms'), 'description': _('Display available part quantity in some forms'), diff --git a/InvenTree/templates/InvenTree/settings/user_search.html b/InvenTree/templates/InvenTree/settings/user_search.html index f54c5fd2ef..f18fb5816c 100644 --- a/InvenTree/templates/InvenTree/settings/user_search.html +++ b/InvenTree/templates/InvenTree/settings/user_search.html @@ -18,6 +18,7 @@ {% 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_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_HIDE_UNAVAILABLE_STOCK" user_setting=True icon='fa-eye-slash' %} {% 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_PURCHASE_ORDERS" user_setting=True icon='fa-shopping-cart' %} diff --git a/InvenTree/templates/js/translated/search.js b/InvenTree/templates/js/translated/search.js index 5900a9b28d..9758ee2ff9 100644 --- a/InvenTree/templates/js/translated/search.js +++ b/InvenTree/templates/js/translated/search.js @@ -122,14 +122,22 @@ function updateSearch() { if (user_settings.SEARCH_PREVIEW_SHOW_STOCK) { // Search for matching stock items + + var filters = { + part_detail: true, + location_detail: true, + }; + + if (user_settings.SEARCH_PREVIEW_HIDE_UNAVAILABLE_STOCK) { + // Only show 'in stock' items in the preview windoww + filters.in_stock = true; + } + addSearchQuery( 'stock', '{% trans "Stock Items" %}', '{% url "api-stock-list" %}', - { - part_detail: true, - location_detail: true, - }, + filters, renderStockItem, { url: '/stock/item', From 33bab19abbbd47783ad72fc84c3d8f65ee407380 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 20 May 2022 17:29:18 +1000 Subject: [PATCH 14/15] Better reporting of settings errors --- InvenTree/common/tests.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/InvenTree/common/tests.py b/InvenTree/common/tests.py index 7f6f6dbe40..f46f1007a5 100644 --- a/InvenTree/common/tests.py +++ b/InvenTree/common/tests.py @@ -163,10 +163,19 @@ class SettingsTest(TestCase): """ for key, setting in InvenTreeSetting.SETTINGS.items(): - self.run_settings_check(key, setting) + + try: + self.run_settings_check(key, setting) + except Exception as exc: + print(f"run_settings_check failed for global setting '{key}'") + raise exc for key, setting in InvenTreeUserSetting.SETTINGS.items(): - self.run_settings_check(key, setting) + try: + self.run_settings_check(key, setting) + except Exception as exc: + print(f"run_settings_check failed for user setting '{key}'") + raise exc def test_defaults(self): """ From cc59ef65fcb2a4f57cc50e204ae85b8021820a82 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 20 May 2022 17:31:08 +1000 Subject: [PATCH 15/15] PEP fixes --- InvenTree/common/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 2beeb26f1d..9095d4af07 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -1428,7 +1428,7 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): 'default': True, 'validator': bool, }, - + 'SEARCH_HIDE_INACTIVE_PARTS': { 'name': _("Hide Inactive Parts"), 'description': _('Excluded inactive parts from search preview window'),