From d391c5059b650646c5e183e7207c37d87f21f099 Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@gmail.com>
Date: Thu, 7 Oct 2021 13:21:30 +1100
Subject: [PATCH] Adds button to sales order page to export to file

---
 InvenTree/order/templates/order/order_base.html       | 2 +-
 InvenTree/order/templates/order/sales_order_base.html | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/InvenTree/order/templates/order/order_base.html b/InvenTree/order/templates/order/order_base.html
index 69e972da6c..6a50497a94 100644
--- a/InvenTree/order/templates/order/order_base.html
+++ b/InvenTree/order/templates/order/order_base.html
@@ -224,7 +224,7 @@ $("#cancel-order").click(function() {
 });
 
 $("#export-order").click(function() {
-    location.href = "{% url 'po-export' order.id %}";
+    location.href = '{% url "po-export" order.id %}';
 });
 
 
diff --git a/InvenTree/order/templates/order/sales_order_base.html b/InvenTree/order/templates/order/sales_order_base.html
index 6f8c422f7a..63f3b037ed 100644
--- a/InvenTree/order/templates/order/sales_order_base.html
+++ b/InvenTree/order/templates/order/sales_order_base.html
@@ -50,6 +50,9 @@ src="{% static 'img/blank_image.png' %}"
         <button type='button' class='btn btn-default' id='print-order-report' title='{% trans "Print" %}'>
             <span class='fas fa-print'></span> 
         </button>
+        <button type='button' class='btn btn-default' id='export-order' title='{% trans "Export order to file" %}'>
+            <span class='fas fa-file-download'></span>
+        </button>
         {% if roles.sales_order.change %}
         <button type='button' class='btn btn-default' id='edit-order' title='{% trans "Edit order information" %}'>
             <span class='fas fa-edit icon-green'></span>
@@ -63,9 +66,11 @@ src="{% static 'img/blank_image.png' %}"
         </button>
         {% endif %}
         {% endif %}
+        <!--
         <button type='button' disabled='' class='btn btn-default' id='packing-list' title='{% trans "Packing List" %}'>
             <span class='fas fa-clipboard-list'></span>
         </button>
+        -->
     </div>
 </div>
 {% endblock %}
@@ -196,4 +201,8 @@ $('#print-order-report').click(function() {
     printSalesOrderReports([{{ order.pk }}]);
 });
 
+$('#export-order').click(function() {
+    location.href = '{% url "so-export" order.id %}';
+});
+
 {% endblock %}
\ No newline at end of file