2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-16 12:05:53 +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:
Oliver
2022-02-03 16:03:46 +11:00
parent eef15b13ec
commit 78b1c7a22b
4 changed files with 33 additions and 11 deletions

View File

@ -12,6 +12,8 @@ from allauth.account.models import EmailAddress
import build.models
import InvenTree.helpers
import InvenTree.tasks
from InvenTree.ready import isImportingData
import part.models as part_models
@ -24,6 +26,10 @@ def check_build_stock(build: build.models.Build):
and send an email out to any subscribed users if stock is low.
"""
# Do not notify if we are importing data
if isImportingData():
return
# Iterate through each of the parts required for this build
lines = []