Skip to content

Commit

Permalink
Disable part parameter enforce units setting
Browse files Browse the repository at this point in the history
  • Loading branch information
eeintech committed Jan 16, 2024
1 parent d1f9eb3 commit 3632d03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kintree/database/inventree_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ def get_inventree_api_timeout():
return False


def set_inventree_db_test_mode():
''' InvenTree test database setup '''
global inventree_api

inventree_api.patch('settings/global/PART_PARAMETER_ENFORCE_UNITS', {'value': False})


def get_inventree_category_id(category_tree: list) -> int:
''' Get InvenTree category ID from name, specificy parent if subcategory '''
global inventree_api
Expand Down
3 changes: 3 additions & 0 deletions kintree/setup_inventree.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def create_categories(parent, name, categories):
if not inventree_connect:
sys.exit(-1)

# Setup database for test
inventree_api.set_inventree_db_test_mode()

if SETUP_CATEGORIES:
for category in categories.keys():
cprint(f'\n[MAIN]\tCreating categories in {category.upper()}')
Expand Down

0 comments on commit 3632d03

Please sign in to comment.