From 2074bf915686c105fe2c0051bece1385b2beba7c Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 2 Jun 2022 15:00:09 +1000 Subject: [PATCH] Fix broken delete button (#3116) * Fix broken delete button * Fix filtering for purchaseorder table on supplierpart page (cherry picked from commit 77fb02ff39c78f1b77eddd48d8f0acb4794fc966) --- .../templates/company/supplier_part.html | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/InvenTree/company/templates/company/supplier_part.html b/InvenTree/company/templates/company/supplier_part.html index d833d581f0..eac1586bad 100644 --- a/InvenTree/company/templates/company/supplier_part.html +++ b/InvenTree/company/templates/company/supplier_part.html @@ -309,7 +309,9 @@ $('#new-price-break').click(function() { }); loadPurchaseOrderTable($("#purchase-order-table"), { - url: "{% url 'api-po-list' %}?supplier_part={{ part.id }}", + params: { + supplier_part: {{ part.id }}, + } }); loadStockTable($("#stock-table"), { @@ -359,14 +361,23 @@ $('#edit-part').click(function () { }); $('#delete-part').click(function() { - - deleteSupplierPart({{ part.pk }}, { - onSuccess: function() { - {% if part.supplier %} - window.location.href = "{% url 'company-detail' part.supplier.id %}"; - {% endif %} + inventreeGet( + '{% url "api-supplier-part-detail" part.pk %}', + {}, + { + success: function(part) { + deleteSupplierParts([part], { + success: function() { + {% if part.supplier %} + window.location.href = '{% url "company-detail" part.supplier.id %}'; + {% else %} + window.location.href = '{% url "index" %}'; + {% endif %} + } + }); + } } - }); + ); }); enableSidebar('supplierpart');