mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 19:20:55 +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):
|
||||
|
@ -5,13 +5,13 @@
|
||||
<table style="border-collapse:collapse; width: 80%;margin-left: 10%; font-size: 1rem">
|
||||
|
||||
<tr style="background: aliceblue; height: 4rem;">
|
||||
<th colspan="3" style="padding-bottom: 1rem; font-size: 1.5rem; color:rgb(210,0, 0)">Part low on stock</th>
|
||||
<th colspan="3" style="padding-bottom: 1rem; font-size: 1.5rem; color:rgb(210,0, 0)">{% trans "Part low on stock" %}</th>
|
||||
</tr>
|
||||
|
||||
<tr style="height: 3rem; border-bottom: 1px solid">
|
||||
<th>Part Name</th>
|
||||
<th>Available Quantity</th>
|
||||
<th>Minimum Quantity</th>
|
||||
<th>{% trans "Part Name" %}</th>
|
||||
<th>{% trans "Available Quantity" %}</th>
|
||||
<th>{% trans "Minimum Quantity" %}</th>
|
||||
</tr>
|
||||
|
||||
<tr style="height: 3rem">
|
||||
|
Reference in New Issue
Block a user