2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-06 12:01:41 +00:00

Tweak low-stock notification (#10112)

- Prevent notification for inactive parts
This commit is contained in:
Oliver
2025-08-01 15:34:30 +10:00
committed by GitHub
parent 37c0322365
commit e494aef1ff

View File

@@ -33,6 +33,10 @@ def notify_low_stock(part: Model):
- Triggered when the available stock for a given part falls be low the configured threhsold
- A notification is delivered to any users who are 'subscribed' to this part
"""
# Do not trigger low-stock notifications for inactive parts
if not part.active:
return
name = _('Low stock notification')
message = _(
f'The available stock for {part.name} has fallen below the configured minimum level'
@@ -146,7 +150,7 @@ def notify_low_stock_if_required(part_id: int):
parts = part.get_ancestors(include_self=True, ascending=True)
for p in parts:
if p.is_part_low_on_stock():
if part.active and p.is_part_low_on_stock():
offload_task(notify_low_stock, p, group='notification')