Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Display modal on clicking change stock in order
Anna Siwikd33210af0381
diff --git a/saleor/dashboard/order/urls.py b/saleor/dashboard/order/urls.pyindex 772192df53..9604215aca 100644--- a/saleor/dashboard/order/urls.py+++ b/saleor/dashboard/order/urls.py@@ -27,6 +27,8 @@ urlpatterns = [views.orderline_split, name='orderline-split'),url(r'^(?P<order_pk>\d+)/line/(?P<line_pk>\d+)/cancel/$',views.orderline_cancel, name='orderline-cancel'),+ url(r'^(?P<order_pk>\d+)/line/(?P<line_pk>\d+)/change-stock/$',+ views.orderline_change_stock, name='orderline-change-stock'),url(r'^(?P<order_pk>\d+)/remove-voucher/$',views.remove_order_voucher, name='order-remove-voucher'),url(r'^(?P<order_pk>\d+)/shipment/(?P<group_pk>\d+)/ship/$',diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.pyindex a3c6535618..71c0a658ba 100644--- a/saleor/dashboard/order/views.py+++ b/saleor/dashboard/order/views.py@@ -392,3 +392,12 @@ def order_packing_slip(request, group_pk):name = "packing-slip-%s-%s" % (group.order.id, group.id)response['Content-Disposition'] = 'filename=%s' % namereturn response+++@staff_member_required+@permission_required('order.edit_order')+def orderline_change_stock(request, order_pk, line_pk):+ status = 200+ ctx = {'order_pk': order_pk, 'line_pk': line_pk}+ template = 'dashboard/order/modal/delivery_group_stock.html'+ return TemplateResponse(request, template, ctx, status=status)diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.htmlindex df45241b5c..c0165e66a3 100644--- a/templates/dashboard/order/detail.html+++ b/templates/dashboard/order/detail.html@@ -270,6 +270,9 @@<th class="wide">{% trans "Item" context "Shipment group table header" %}</th>+ <th>+ {% trans "Stock" context "Shipment group table header" %}+ </th><th>{% trans "SKU" context "Shipment group table header" %}</th>@@ -304,6 +307,23 @@<td>{{ item.product_name }}<br></td>+ <td class="right-align">+ {% if group.status != 'cancelled' %}+ <a class="dropdown-button" href="#" data-activates="line-stock-actions-{{ item.pk }}" data-constrainwidth="false">+ {{ item.stock_location|default:"-" }}+ <svg data-src="{% static "dashboard/images/arrow_drop_down.svg" %}" width="24" height="24" />+ </a>+ <ul id="line-stock-actions-{{ item.pk }}" class="dropdown-content">+ <li>+ <a href="#base-modal" data-href="{% url 'dashboard:orderline-change-stock' order_pk=order.pk line_pk=item.pk %}" class="modal-trigger-custom" {% if group.status != 'new' %} disabled{% endif %} title="{% trans "Change stock location" context "Shipment group table row action" %}">+ {% trans "Change stock" context "Shipment group table row action" %}+ </a>+ </li>+ </ul>+ {% else %}+ {{ item.stock_location|default:"-" }}+ {% endif %}+ </td><td>{{ item.product_sku }}</td>diff --git a/templates/dashboard/order/modal/delivery_group_stock.html b/templates/dashboard/order/modal/delivery_group_stock.htmlnew file mode 100644index 0000000000..d92b023099--- /dev/null+++ b/templates/dashboard/order/modal/delivery_group_stock.html@@ -0,0 +1,21 @@+{% load i18n %}+{% load materializecss %}++<form method="post" role="form" action="{% url 'dashboard:orderline-change-stock' order_pk=order_pk line_pk=line_pk %}" class="form-async" novalidate>+ {% csrf_token %}+ <div class="modal-content">+ <h5>+ {% trans "Change stock" context "Modal change stock title" %}+ </h5>+ <div class="row">+ </div>+ </div>+ <div class="modal-footer">+ <button type="submit" class="modal-action btn-flat">+ {% trans "Save" context "Dashboard update action" %}+ </button>+ <a href="#!" aria-hidden="true" class="modal-action modal-close btn-flat">+ {% trans "Cancel" context "Dashboard cancel action" %}+ </a>+ </div>+</form>