mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 21:15:41 +00:00
Skips some specific steps when importing data
- We need to prevent certain operations from running when we are importing data - This is to prevent unique database constraints from being violated - Do not register plugins during data import - Do not launch notification events
This commit is contained in:
@ -8,6 +8,7 @@ from django.conf import settings
|
||||
|
||||
from maintenance_mode.core import set_maintenance_mode
|
||||
|
||||
from InvenTree.ready import isImportingData
|
||||
from plugin import registry
|
||||
|
||||
|
||||
@ -19,13 +20,17 @@ class PluginAppConfig(AppConfig):
|
||||
|
||||
def ready(self):
|
||||
if settings.PLUGINS_ENABLED:
|
||||
logger.info('Loading InvenTree plugins')
|
||||
|
||||
if isImportingData():
|
||||
logger.info('Skipping plugin loading for data import')
|
||||
else:
|
||||
logger.info('Loading InvenTree plugins')
|
||||
|
||||
if not registry.is_loading:
|
||||
# this is the first startup
|
||||
registry.collect_plugins()
|
||||
registry.load_plugins()
|
||||
if not registry.is_loading:
|
||||
# this is the first startup
|
||||
registry.collect_plugins()
|
||||
registry.load_plugins()
|
||||
|
||||
# drop out of maintenance
|
||||
# makes sure we did not have an error in reloading and maintenance is still active
|
||||
set_maintenance_mode(False)
|
||||
# drop out of maintenance
|
||||
# makes sure we did not have an error in reloading and maintenance is still active
|
||||
set_maintenance_mode(False)
|
||||
|
Reference in New Issue
Block a user