mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2248 from SchrodingersGat/email-fixes
Fixes for low-stock emails
This commit is contained in:
commit
345bccb9bc
@ -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')
|
||||
|
@ -8,15 +8,12 @@
|
||||
{% if link %}
|
||||
<p>{% trans "Click on the following link to view this part" %}: <a href="{{ link }}">{{ link }}</a></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block subtitle %}
|
||||
<p><em>{% blocktrans with part=part.name %}You are receiving this email because you are subscribed to notifications for this part {% endblocktrans %}.</em></p>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<tr style="height: 3rem; border-bottom: 1px solid">
|
||||
<th>{% trans "Part Name" %}</th>
|
||||
<th>{% trans "Part" %}</th>
|
||||
<th>{% trans "Total Stock" %}</th>
|
||||
<th>{% trans "Available" %}</th>
|
||||
<th>{% trans "Minimum Quantity" %}</th>
|
||||
@ -24,8 +21,12 @@
|
||||
|
||||
<tr style="height: 3rem">
|
||||
<td style="text-align: center;">{{ part.full_name }}</td>
|
||||
<td style="text-align: center;">{{ part.total_stock }}</td>
|
||||
<td style="text-align: center;">{{ part.available_stock }}</td>
|
||||
<td style="text-align: center;">{{ part.minimum_stock }}</td>
|
||||
<td style="text-align: center;">{% decimal part.total_stock %}</td>
|
||||
<td style="text-align: center;">{% decimal part.available_stock %}</td>
|
||||
<td style="text-align: center;">{% decimal part.minimum_stock %}</td>
|
||||
</tr>
|
||||
{% endblock %}
|
||||
{% endblock body %}
|
||||
|
||||
{% block footer_prefix %}
|
||||
<p><em>{% blocktrans with part=part.name %}You are receiving this email because you are subscribed to notifications for this part {% endblocktrans %}.</em></p>
|
||||
{% endblock footer_prefix %}
|
||||
|
Loading…
Reference in New Issue
Block a user