Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Display stock and modify action only if many
Anna Siwikd4999e4a544c
diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.pyindex 7804edc5e9..d6b4ccb34d 100644--- a/saleor/dashboard/order/views.py+++ b/saleor/dashboard/order/views.py@@ -6,13 +6,13 @@ from django.http import HttpResponsefrom django.shortcuts import get_object_or_404, redirectfrom django.template.context_processors import csrffrom django.template.response import TemplateResponse-from django.urls import reversefrom django.utils.translation import pgettext_lazyfrom django_prices.templatetags.prices_i18n import grossfrom payments import PaymentStatusfrom prices import Pricefrom satchless.item import InsufficientStock+from saleor.product.models import StockLocationfrom .filters import OrderFilterfrom .forms import (AddressForm, AddVariantToDeliveryGroupForm, CancelGroupForm,@@ -23,7 +23,7 @@ from .forms import (from .utils import (create_invoice_pdf, create_packing_slip_pdf, get_statics_absolute_url)from ..views import staff_member_required-from ...core.utils import get_paginator_items, build_absolute_uri+from ...core.utils import get_paginator_itemsfrom ...order import GroupStatusfrom ...order.models import DeliveryGroup, Order, OrderLine, OrderNote@@ -71,10 +71,12 @@ def order_details(request, order_pk):else:can_capture = can_release = can_refund = False+ is_many_stock_locations = StockLocation.objects.count() > 1ctx = {'order': order, 'all_payments': all_payments, 'payment': payment,'notes': notes, 'groups': groups, 'captured': captured,'preauthorized': preauthorized, 'can_capture': can_capture,'can_release': can_release, 'can_refund': can_refund,+ 'is_many_stock_locations': is_many_stock_locations,'balance': balance}return TemplateResponse(request, 'dashboard/order/detail.html', ctx)diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.htmlindex 7ec083a4da..d7c1659621 100644--- a/templates/dashboard/order/detail.html+++ b/templates/dashboard/order/detail.html@@ -297,7 +297,7 @@<td class="right-align">{% if group.can_edit_lines %}<a class="dropdown-button" href="#" data-activates="line-actions-{{ line.pk }}" data-constrainwidth="false">- {{ line.quantity }} {% if line.stock_location %} ({{ line.stock_location|truncatechars:10 }}) {% endif %}+ {{ line.quantity }} {% if line.stock_location and is_many_stock_locations %} ({{ line.stock_location|truncatechars:10 }}) {% endif %}<svg data-src="{% static "dashboard/images/arrow-drop-down.svg" %}" width="24" height="24" /></a><ul id="line-actions-{{ line.pk }}" class="dropdown-content">@@ -306,11 +306,13 @@{% trans "Change quantity" context "Shipment group table row action" %}</a></li>- <li>- <a href="#base-modal" data-href="{% url 'dashboard:orderline-change-stock' order_pk=order.pk line_pk=line.pk %}" class="modal-trigger-custom" title="{% trans "Change stock location" context "Shipment group table row action" %}">- {% trans "Change stock" context "Shipment group table row action" %}- </a>- </li>+ {% if is_many_stock_locations %}+ <li>+ <a href="#base-modal" data-href="{% url 'dashboard:orderline-change-stock' order_pk=order.pk line_pk=line.pk %}" class="modal-trigger-custom" title="{% trans "Change stock location" context "Shipment group table row action" %}">+ {% trans "Change stock" context "Shipment group table row action" %}+ </a>+ </li>+ {% endif %}<li><a href="#base-modal" data-href="{% url 'dashboard:orderline-split' order_pk=order.pk line_pk=line.pk %}" class="modal-trigger-custom" title="{% trans "Split line" context "Shipment group table row action" %}">{% trans "Split order line" context "Shipment group table row action" %}