From 8e6aaa89f91f94ada7bce7f5660dbe783d63cae0 Mon Sep 17 00:00:00 2001
From: Matthias <matthias.mair@oewf.org>
Date: Sat, 23 Oct 2021 23:40:57 +0200
Subject: [PATCH] calculate true / false for fields

---
 InvenTree/part/views.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py
index 55147c933b..f9bd57e767 100644
--- a/InvenTree/part/views.py
+++ b/InvenTree/part/views.py
@@ -389,16 +389,16 @@ class PartImport(FileManagementFormView):
                 default_location=optional_matches['default_location'],
                 default_supplier=optional_matches['default_supplier'],
                 variant_of=optional_matches['variant_of'],
-                active=optional_matches['active'],
-                base_cost=optional_matches['base_cost'],
-                multiple=optional_matches['multiple'],
-                assembly=optional_matches['assembly'],
-                component=optional_matches['component'],
-                is_template=optional_matches['is_template'],
-                purchaseable=optional_matches['purchaseable'],
-                salable=optional_matches['salable'],
-                trackable=optional_matches['trackable'],
-                virtual=optional_matches['virtual'],
+                active=str2bool(part_data.get('active', None)),
+                base_cost=part_data.get('base_cost', None),
+                multiple=part_data.get('multiple', None),
+                assembly=str2bool(part_data.get('assembly', None)),
+                component=str2bool(part_data.get('component', None)),
+                is_template=str2bool(part_data.get('is_template', None)),
+                purchaseable=str2bool(part_data.get('purchaseable', None)),
+                salable=str2bool(part_data.get('salable', None)),
+                trackable=str2bool(part_data.get('trackable', None)),
+                virtual=str2bool(part_data.get('virtual', None)),
             )
             try:
                 new_part.save()