Prevent creation of new settings objects when importing data (#3319)

This commit is contained in:
Oliver 2022-07-11 09:40:44 +10:00 committed by GitHub
parent 648faf4ed2
commit 7376e34505
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -343,6 +343,10 @@ class BaseInvenTreeSetting(models.Model):
# Unless otherwise specified, attempt to create the setting
create = kwargs.get('create', True)
# Prevent creation of new settings objects when importing data
if InvenTree.ready.isImportingData() or not InvenTree.ready.canAppAccessDatabase(allow_test=True):
create = False
if create:
# Attempt to create a new settings object
setting = cls(