make imports on function level

This commit is contained in:
Matthias Mair 2022-05-16 18:01:16 +02:00
parent 18a263ff75
commit cce3d3a35d
2 changed files with 3 additions and 2 deletions

View File

@ -39,7 +39,6 @@ from plugin.events import trigger_event
from part import models as PartModels
from stock import models as StockModels
from users import models as UserModels
from . import tasks as build_tasks
def get_next_build_number():
@ -1140,6 +1139,7 @@ def after_save_build(sender, instance: Build, created: bool, **kwargs):
"""
Callback function to be executed after a Build instance is saved
"""
from . import tasks as build_tasks
if created:
# A new Build has just been created

View File

@ -46,7 +46,6 @@ from users.models import Owner
from company import models as CompanyModels
from part import models as PartModels
from part import tasks as part_tasks
class StockLocation(MetadataMixin, InvenTreeTree):
@ -2021,6 +2020,7 @@ def after_delete_stock_item(sender, instance: StockItem, **kwargs):
"""
Function to be executed after a StockItem object is deleted
"""
from part import tasks as part_tasks
if not InvenTree.ready.isImportingData():
# Run this check in the background
@ -2032,6 +2032,7 @@ def after_save_stock_item(sender, instance: StockItem, created, **kwargs):
"""
Hook function to be executed after StockItem object is saved/updated
"""
from part import tasks as part_tasks
if not InvenTree.ready.isImportingData():
# Run this check in the background