Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Move fulfilling order to separate view
Anna Siwik329b9dd2281a
diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.pyindex 4aed438fbb..9abddd4330 100644--- a/saleor/dashboard/order/views.py+++ b/saleor/dashboard/order/views.py@@ -398,8 +398,9 @@ def fulfill_order_lines(request, order_pk):OrderStatus.FULFILLED if order.is_fulfilled()else OrderStatus.PARTIALLY_FULFILLED)order.save(update_fields=['status'])+ return redirect('dashboard:order-details', order_pk=order.pk)elif form.errors:status = 400ctx = {'form': form, 'formset': formset, 'order': order}- template = 'dashboard/order/modal/fulfill_order_lines.html'+ template = 'dashboard/order/fulfillment.html'return TemplateResponse(request, template, ctx, status=status)diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.htmlindex 438be85c65..b168b37dad 100644--- a/templates/dashboard/order/detail.html+++ b/templates/dashboard/order/detail.html@@ -331,7 +331,7 @@{% if perms.order.edit_order and order.can_edit or order.can_fulfill %}<div class="data-table-action">{% if order.can_fulfill %}- <a href="#base-modal" data-href="{% url 'dashboard:fulfill-order-lines' order_pk=order.pk %}" class="btn-flat waves-effect modal-trigger-custom" title="{% trans "Fulfill order" context "Order summary card action title" %}">+ <a href="{% url 'dashboard:fulfill-order-lines' order_pk=order.pk %}" class="btn-flat waves-effect" title="{% trans "Fulfill order" context "Order summary card action title" %}">{% trans "Fulfill" context "Order summary card action" %}</a>{% endif %}diff --git a/templates/dashboard/order/fulfillment.html b/templates/dashboard/order/fulfillment.htmlnew file mode 100644index 0000000000..4cad618da2--- /dev/null+++ b/templates/dashboard/order/fulfillment.html@@ -0,0 +1,121 @@+{% extends "dashboard/base.html" %}+{% load babel %}+{% load prices_i18n %}+{% load i18n %}+{% load i18n_address_tags %}+{% load materializecss %}+{% load status %}+{% load staticfiles %}+{% load dashboard %}+{% load discount_amount_for from prices %}++{% block title %}+ {% trans "Fulfill" context "Dashboard order fulfillment" %} {{ order }} - {% trans "Orders" context "Dashboard orders list" %} - {{ block.super }}+{% endblock %}++{% block body_class %}body-orders{% endblock %}++{% block menu_orders_class %}active{% endblock %}++{% block header_menu %}+ {% url "dashboard:orders" as url %}+ {% include "dashboard/includes/_back_link.html" with url=url %}+{% endblock %}++{% block breadcrumbs %}+ <ul class="breadcrumbs breadcrumbs--history">+ <li>+ <a href="{% url "dashboard:orders" %}">+ {% trans "Orders" context "Dashboard orders list" %}+ </a>+ </li>+ <li class="back-mobile">+ <a href="{% url "dashboard:orders" %}">+ <svg data-src="{% static "dashboard/images/arrow-left.svg" %}" fill="#fff" width="20px" height="20px" />+ </a>+ </li>+ <li>+ <a href="{% url 'dashboard:order-details' order_pk=order.pk %}" class="breadcrumbs--ellipsed-item">+ {{ order }}+ </a>+ </li>+ <li>+ <span>+ {% trans "Fulfill" context "Dashboard order fulfillment" %}+ </span>+ </li>+ </ul>+{% endblock %}++{% block content %}+<div class="row">+ <div class="col s12 l9">+ <form role="form" class="card" method="post" action="{% block action_url %}#!{% endblock %}" novalidate>+ {% csrf_token %}+ {{ formset.management_form }}+ <div class="card-content">+ <span class="card-title">+ {% trans "Fulfill order" context "Fulfill order title" %}+ </span>+ <div class="row">+ <div class="col s12">+ <table>+ <thead>+ <tr>+ <th class="wide">+ {% trans "Item" context "Modal remove order line table header" %}+ </th>+ <th>+ {% trans "SKU" context "Modal remove order line table header" %}+ </th>+ <th class="right-align">+ {% trans "Quantity" context "Modal remove order line table header" %}+ </th>+ </tr>+ </thead>+ <tbody>+ {% for line in order.get_unfulfilled_lines %}+ <tr>+ <td>+ {{ line.product_name }}<br>+ </td>+ <td>+ {{ line.product_sku }}+ </td>+ <td class="right-align">+ {% get_formset_form formset forloop.counter0 as line_form %}+ <input id="{{ line_form.order_line.auto_id }}"+ type="hidden"+ name="{{ line_form.order_line.html_name }}"+ required="{{ line_form.order_line.field.required }}"+ value="{{ line_form.order_line.value }}">+ <input id="{{ line_form.quantity.auto_id }}"+ max="{{ line.quantity_unfulfilled }}"+ min="0"+ name="{{ line_form.quantity.html_name }}"+ required="{{ line_form.quantity.field.required }}"+ type="number"+ value="{{ line_form.quantity.value }}">+ </td>+ </tr>+ {% endfor %}+ </tbody>+ </table>+ </div>+ <div class="col s12 m6">+ {{ form }}+ </div>+ </div>+ </div>+ <div class="card-action right-align">+ <a href="{% url 'dashboard:order-details' order.pk %}" class="btn-flat waves-effect">+ {% trans "Cancel" context "Dashboard cancel action" %}+ </a>+ <button type="submit" class="btn waves-effect">+ {% trans "Save" context "Dashboard update action" %}+ </button>+ </div>+ </form>+ </div>+</div>+{% endblock %}diff --git a/templates/dashboard/order/modal/fulfill_order_lines.html b/templates/dashboard/order/modal/fulfill_order_lines.htmldeleted file mode 100644index 8db45f1dbb..0000000000--- a/templates/dashboard/order/modal/fulfill_order_lines.html+++ /dev/null@@ -1,66 +0,0 @@-{% extends "dashboard/base_modal.html" %}--{% load i18n %}-{% load materializecss %}-{% load dashboard %}--{% block action_url %}-{% url 'dashboard:fulfill-order-lines' order_pk=order.pk %}-{% endblock %}--{% block title %}-{% trans "Fulfill order" context "Modal fulfill order title" %}-{% endblock %}--{% block content %}- {{ formset.management_form }}- <div class="col s12">- <table>- <thead>- <tr>- <th class="wide">- {% trans "Item" context "Modal remove order line table header" %}- </th>- <th>- {% trans "SKU" context "Modal remove order line table header" %}- </th>- <th class="right-align">- {% trans "Quantity" context "Modal remove order line table header" %}- </th>- </tr>- </thead>- <tbody>- {% for line in order.get_unfulfilled_lines %}- <tr>- <td>- {{ line.product_name }}<br>- </td>- <td>- {{ line.product_sku }}- </td>- <td class="right-align">- {% get_formset_form formset forloop.counter0 as line_form %}- <input id="{{ line_form.order_line.auto_id }}"- type="hidden"- name="{{ line_form.order_line.html_name }}"- required="{{ line_form.order_line.field.required }}"- value="{{ line_form.order_line.value }}">- <input id="{{ line_form.quantity.auto_id }}"- max="{{ line.quantity_unfulfilled }}"- min="0"- name="{{ line_form.quantity.html_name }}"- required="{{ line_form.quantity.field.required }}"- type="number"- value="{{ line_form.quantity.value }}">- </td>- </tr>- {% endfor %}- </tbody>- </table>- </div>- {{ form }}-{% endblock %}--{% block primary_action %}-{% trans "Fulfill" context "Modal fulfill order primary action" %}-{% endblock %}