Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add listing notes to payment page

akjanikab689bffa657
diff --git a/saleor/order/migrations/0030_auto_20180117_0835.py b/saleor/order/migrations/0030_auto_20180117_0835.py
deleted file mode 100644
index 02161ac575..0000000000
--- a/saleor/order/migrations/0030_auto_20180117_0835.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.5 on 2018-01-17 14:35
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('order', '0029_auto_20180111_0845'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='ordernote',
- options={'ordering': ('date',)},
- ),
- migrations.AddField(
- model_name='ordernote',
- name='is_public',
- field=models.BooleanField(default=True),
- ),
- migrations.AlterField(
- model_name='ordernote',
- name='date',
- field=models.DateTimeField(auto_now_add=True, db_index=True),
- ),
- ]
diff --git a/saleor/order/views.py b/saleor/order/views.py
index 80775dd3db..8507880cb7 100644
--- a/saleor/order/views.py
+++ b/saleor/order/views.py
@@ -70,10 +70,11 @@ def payment(request, token):
payment_method = payment_form.cleaned_data['method']
return redirect(
'order:payment', token=order.token, variant=payment_method)
+ notes = order.notes.filter(is_public=True)
ctx = {
'order': order, 'groups': groups, 'payment_form': payment_form,
'payments': payments, 'waiting_payment': waiting_payment,
- 'waiting_payment_form': waiting_payment_form}
+ 'waiting_payment_form': waiting_payment_form, 'notes': notes}
return TemplateResponse(request, 'order/payment.html', ctx)
diff --git a/templates/order/details.html b/templates/order/details.html
index 855ec1df0e..bb6697584a 100644
--- a/templates/order/details.html
+++ b/templates/order/details.html
@@ -65,14 +65,13 @@
{% if notes %}
<h2 class="order-notes__header">{% trans "Notes" context "Order notes list" %}</h2>
{% for note in notes %}
- {% if note.is_public %}
<small>
{% if note.user == user %}
{% blocktrans with date=note.date %}
{{ date }} by you
{% endblocktrans %}
{% elif note.user.is_staff %}
- {% trans 'staff user' context 'Order note author is staff' as note_author_staff%}
+ {% trans 'staff' context 'Order note author is staff' as note_author_staff%}
{% blocktrans with author=note_author_staff date=note.date %}
{{ date }} by <span class="text-muted">{{ author }}</span>
{% endblocktrans %}
@@ -83,7 +82,6 @@
{% endif %}
</small>
<p>{{note.content}}</p>
- {% endif %}
{% endfor %}
{% endif %}
{% if order.is_open %}
diff --git a/templates/order/payment.html b/templates/order/payment.html
index e1674a9b5d..ea901aeec2 100644
--- a/templates/order/payment.html
+++ b/templates/order/payment.html
@@ -90,6 +90,28 @@
{% endif %}
{% endif %}
{% include 'order/_ordered_items_table.html' %}
+ {% if notes %}
+ <h2 class="order-notes__header">{% trans "Notes" context "Order notes list" %}</h2>
+ {% for note in notes %}
+ <small>
+ {% if note.user == user %}
+ {% blocktrans with date=note.date %}
+ {{ date }} by you
+ {% endblocktrans %}
+ {% elif note.user.is_staff %}
+ {% trans 'staff' context 'Order note author is staff' as note_author_staff%}
+ {% blocktrans with author=note_author_staff date=note.date %}
+ {{ date }} by <span class="text-muted">{{ author }}</span>
+ {% endblocktrans %}
+ {% else %}
+ {% blocktrans with author=note.author date=note.date %}
+ {{ date }} by {{ author }}
+ {% endblocktrans %}
+ {% endif %}
+ </small>
+ <p>{{note.content}}</p>
+ {% endfor %}
+ {% endif %}
</div>
</div>
{% endblock content %}
diff --git a/templates/templated_email/order/note/confirm_note.email b/templates/templated_email/order/note/confirm_note.email
index 8410d6e90c..1611fa76a5 100644
--- a/templates/templated_email/order/note/confirm_note.email
+++ b/templates/templated_email/order/note/confirm_note.email
@@ -1,7 +1,7 @@
{% load i18n %}
{% block subject %}
- {% trans "New note" context "Note confirmation email subject" %}
+ {% trans "New note has been added to your order" context "Note confirmation email subject" %}
{% endblock %}
{% block plain %}