From 5ae62410834228df8338bd150d5aeb8bf9cecd07 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 4 Nov 2021 16:15:11 +1100 Subject: [PATCH] Fixes for low-stock emails - Include variant stock in test - Improve email template --- InvenTree/part/models.py | 2 +- InvenTree/templates/email/low_stock_notification.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index f37b61864d..9dd4031886 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -2098,7 +2098,7 @@ class Part(MPTTModel): Returns True if the total stock for this part is less than the minimum stock level """ - return self.total_stock <= self.minimum_stock + return self.get_stock_count() <= self.minimum_stock @receiver(post_save, sender=Part, dispatch_uid='part_post_save_log') diff --git a/InvenTree/templates/email/low_stock_notification.html b/InvenTree/templates/email/low_stock_notification.html index 4db9c2ddaa..7b52ebc0cd 100644 --- a/InvenTree/templates/email/low_stock_notification.html +++ b/InvenTree/templates/email/low_stock_notification.html @@ -24,8 +24,8 @@ {{ part.full_name }} - {{ part.total_stock }} - {{ part.available_stock }} - {{ part.minimum_stock }} + {% decimal part.total_stock %} + {% part.available_stock %} + {% part.minimum_stock %} {% endblock %}