mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	use direct import instead of text for offload
This commit is contained in:
		@@ -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):
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
            )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user