From 1ba7110cda89744f98c86a6935f429b33fefe905 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 4 Dec 2021 02:19:12 +0100 Subject: [PATCH] change templates to new way --- InvenTree/part/tasks.py | 7 +++++-- InvenTree/templates/email/low_stock_notification.html | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/InvenTree/part/tasks.py b/InvenTree/part/tasks.py index 2f6b58afa9..bb950fc098 100644 --- a/InvenTree/part/tasks.py +++ b/InvenTree/part/tasks.py @@ -16,13 +16,16 @@ logger = logging.getLogger("inventree") def notify_low_stock(part: part.models.Part): + name = _("Low stock notification") + message = _(f'The available stock for {part.name} has fallen below the configured minimum level') context = { - # Pass the "Part" object through to the template context 'part': part, + 'name': name, + 'message': message, 'link': InvenTree.helpers.construct_absolute_url(part.get_absolute_url()), 'template': { 'html': 'email/low_stock_notification.html', - 'subject': "[InvenTree] " + _("Low stock notification"), + 'subject': "[InvenTree] " + name, }, } diff --git a/InvenTree/templates/email/low_stock_notification.html b/InvenTree/templates/email/low_stock_notification.html index f922187f33..01c475cd87 100644 --- a/InvenTree/templates/email/low_stock_notification.html +++ b/InvenTree/templates/email/low_stock_notification.html @@ -4,7 +4,7 @@ {% load inventree_extras %} {% block title %} -{% blocktrans with part=part.name %} The available stock for {{ part }} has fallen below the configured minimum level{% endblocktrans %} +{{ message }} {% if link %}

{% trans "Click on the following link to view this part" %}: {{ link }}

{% endif %}