2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

use direct import instead of text for offload

This commit is contained in:
Matthias Mair
2022-05-16 17:45:51 +02:00
parent 9ec626b650
commit 0f5c03e44c
8 changed files with 17 additions and 14 deletions

View File

@ -63,6 +63,7 @@ from stock import models as StockModels
import common.models
import part.settings as part_settings
from part import tasks as part_tasks
logger = logging.getLogger("inventree")
@ -2298,7 +2299,7 @@ def after_save_part(sender, instance: Part, created, **kwargs):
# Check part stock only if we are *updating* the part (not creating it)
# Run this check in the background
InvenTree.tasks.offload_task('part.tasks.notify_low_stock_if_required', instance)
InvenTree.tasks.offload_task(part_tasks.notify_low_stock_if_required, instance)
class PartAttachment(InvenTreeAttachment):

View File

@ -10,6 +10,7 @@ import InvenTree.tasks
import common.notifications
import part.models
from part import tasks as part_tasks
logger = logging.getLogger("inventree")
@ -49,6 +50,6 @@ def notify_low_stock_if_required(part: part.models.Part):
for p in parts:
if p.is_part_low_on_stock():
InvenTree.tasks.offload_task(
'part.tasks.notify_low_stock',
part_tasks.notify_low_stock,
p
)