diff --git a/hypha/apply/activity/messaging.py b/hypha/apply/activity/messaging.py index 9967d6c4863046ae5519c9cfc343ead119166c6a..1a3ab00b749bc1981d1f05da96307010714e4d7d 100644 --- a/hypha/apply/activity/messaging.py +++ b/hypha/apply/activity/messaging.py @@ -253,7 +253,7 @@ class ActivityAdapter(AdapterBase): MESSAGES.UPLOAD_CONTRACT: _('Uploaded a {contract.state} contract'), MESSAGES.APPROVE_CONTRACT: _('Approved contract'), MESSAGES.UPDATE_PAYMENT_REQUEST_STATUS: _('Updated Payment Request status to: {payment_request.status_display}'), - MESSAGES.UPDATE_INVOICE_STATUS: _('Updated Invoice status to: {invoice.status_display}'), + MESSAGES.UPDATE_INVOICE_STATUS: 'handle_update_invoice_status', MESSAGES.REQUEST_PAYMENT: _('Payment Request submitted'), MESSAGES.CREATE_INVOICE: _('Invoice created'), MESSAGES.SUBMIT_REPORT: _('Submitted a report'), @@ -378,6 +378,15 @@ class ActivityAdapter(AdapterBase): else: return "Marked a Report as required" + def handle_update_invoice_status(self, invoice, **kwargs): + invoice_status_change = _(f'Updated Invoice status to: {invoice.status_display}.') + if invoice.comment: + sent_message = _(' Sent message: ') + comment = invoice.comment + message = invoice_status_change + sent_message + comment + return message + return invoice_status_change + def send_message(self, message, user, source, sources, **kwargs): from .models import Activity visibility = kwargs.get('visibility', ALL) diff --git a/hypha/apply/activity/templates/messages/email/invoice_status_updated.html b/hypha/apply/activity/templates/messages/email/invoice_status_updated.html index b1b40f81bd04a4cc9263451a6fd40e75f75a79a5..37ece10e193e3c0acaa72545d891f6b9669b1c1b 100644 --- a/hypha/apply/activity/templates/messages/email/invoice_status_updated.html +++ b/hypha/apply/activity/templates/messages/email/invoice_status_updated.html @@ -2,15 +2,18 @@ {% load i18n %} {% block content %} -{% blocktrans with title=source.title date_from=invoice.date_from date_to=invoice.date_to %}An {{ ORG_SHORT_NAME }} staff member has updated your invoice for {{ title }} for period {{ date_from }} to {{ date_to }}.{% endblocktrans %} + +{% blocktrans with title=source.title date_from=invoice.date_from date_to=invoice.date_to %}An {{ ORG_SHORT_NAME }} staff member has updated your invoice for {{ date_from }} for period to {{ date_to }}.{% endblocktrans %} + {% blocktrans with status=invoice.get_status_display %}It is now {{ status }}.{% endblocktrans %} -{% if has_changes_requested %} -{% trans "The staff member left this comment" %}: +{% if has_changes_requested and invoice.comment %} + {% trans "The staff member left this comment" %}: -{{ payment_request.comment }} + {{ invoice.comment }} {% endif %} +{% trans "Invoice Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ invoice.get_absolute_url }} {% trans "Title" %}: {{ source.title }} -{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} +{% trans "Project Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }} {% endblock %}