From 11f147fd3479d99c74427e554627b24a349acad5 Mon Sep 17 00:00:00 2001 From: bloemp Date: Tue, 24 Jan 2023 23:32:17 +0100 Subject: [PATCH] Reload purchase order table after part order (#4219) * Reload purchase order table after part order When on the part page, going to the "Purchase order" sidebar tab. You can order the part by pressing the "Order Part" button. After a succefull order, the form closes but the table on the page was never refreshed. * Fixed a js styling check error --- InvenTree/part/templates/part/detail.html | 6 +++++- InvenTree/templates/js/translated/order.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 866a6c27e4..f8a6990a24 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -757,7 +757,11 @@ success: function(part) { orderParts( [part], - {} + { + onSuccess: function() { + $("#purchase-order-table").bootstrapTable('refresh'); + } + } ); } } diff --git a/InvenTree/templates/js/translated/order.js b/InvenTree/templates/js/translated/order.js index ef3842ad53..f8977f5996 100644 --- a/InvenTree/templates/js/translated/order.js +++ b/InvenTree/templates/js/translated/order.js @@ -1032,7 +1032,7 @@ function exportOrder(redirect_url, options={}) { /* * Create a new form to order parts based on the list of provided parts. */ -function orderParts(parts_list, options={}) { +function orderParts(parts_list, options) { var parts = []; @@ -1162,6 +1162,10 @@ function orderParts(parts_list, options={}) { // If the modal is now "empty", dismiss it if (!($(opts.modal).find('.part-order-row').exists())) { closeModal(opts.modal); + // If there is a onSuccess callback defined, call it + if (options && options.onSuccess) { + options.onSuccess(); + } } }