mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-09 07:00:56 +00:00
Created part.tasks file and moved notify_low_stock function to the same from InvenTree.tasks. The argument type is changed from StockItem to Part
Added trans to headers of table in email template of low_stock_notification.html added is_part_low_on_stock() function to the part model to check if the part's stock has fallen below the minimum quantity used offload_task function to run the low stock notification function asynchronously
This commit is contained in:
@ -1659,8 +1659,11 @@ def after_save_stock_item(sender, instance: StockItem, **kwargs):
|
||||
starred the part
|
||||
"""
|
||||
|
||||
if instance.quantity <= instance.part.minimum_stock:
|
||||
inventree_tasks.notify_low_stock(instance)
|
||||
if instance.part.is_part_low_on_stock():
|
||||
inventree_tasks.offload_task(
|
||||
'part.tasks.notify_low_stock',
|
||||
instance.part
|
||||
)
|
||||
|
||||
|
||||
class StockItemAttachment(InvenTreeAttachment):
|
||||
|
Reference in New Issue
Block a user