2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 04:26:44 +00:00

Merge pull request #2248 from SchrodingersGat/email-fixes

Fixes for low-stock emails
This commit is contained in:
Oliver 2021-11-04 16:48:28 +11:00 committed by GitHub
commit 345bccb9bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View File

@ -2098,7 +2098,7 @@ class Part(MPTTModel):
Returns True if the total stock for this part is less than the minimum stock level 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') @receiver(post_save, sender=Part, dispatch_uid='part_post_save_log')

View File

@ -8,15 +8,12 @@
{% if link %} {% if link %}
<p>{% trans "Click on the following link to view this part" %}: <a href="{{ link }}">{{ link }}</a></p> <p>{% trans "Click on the following link to view this part" %}: <a href="{{ link }}">{{ link }}</a></p>
{% endif %} {% 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 %} {% block body %}
<tr style="height: 3rem; border-bottom: 1px solid"> <tr style="height: 3rem; border-bottom: 1px solid">
<th>{% trans "Part Name" %}</th> <th>{% trans "Part" %}</th>
<th>{% trans "Total Stock" %}</th> <th>{% trans "Total Stock" %}</th>
<th>{% trans "Available" %}</th> <th>{% trans "Available" %}</th>
<th>{% trans "Minimum Quantity" %}</th> <th>{% trans "Minimum Quantity" %}</th>
@ -24,8 +21,12 @@
<tr style="height: 3rem"> <tr style="height: 3rem">
<td style="text-align: center;">{{ part.full_name }}</td> <td style="text-align: center;">{{ part.full_name }}</td>
<td style="text-align: center;">{{ part.total_stock }}</td> <td style="text-align: center;">{% decimal part.total_stock %}</td>
<td style="text-align: center;">{{ part.available_stock }}</td> <td style="text-align: center;">{% decimal part.available_stock %}</td>
<td style="text-align: center;">{{ part.minimum_stock }}</td> <td style="text-align: center;">{% decimal part.minimum_stock %}</td>
</tr> </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 %}