Fix broken delete button (#3116)

* Fix broken delete button

* Fix filtering for purchaseorder table on supplierpart page

(cherry picked from commit 77fb02ff39)
This commit is contained in:
Oliver 2022-06-02 15:00:09 +10:00 committed by GitHub
parent bc8777f93c
commit 2074bf9156
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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');