From cf5d637678fe867612c04d340adc0d01d7cb22c6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:30:57 +1000 Subject: [PATCH] Add missing callback for attachment delete button (#5219) (#5220) (cherry picked from commit b3dcc28bd9fae475877e1446f19802ed639c1c8c) Co-authored-by: Oliver --- InvenTree/templates/js/translated/attachment.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/InvenTree/templates/js/translated/attachment.js b/InvenTree/templates/js/translated/attachment.js index 6c925edf1f..4ec0b4b625 100644 --- a/InvenTree/templates/js/translated/attachment.js +++ b/InvenTree/templates/js/translated/attachment.js @@ -281,10 +281,20 @@ function loadAttachmentTable(url, options) { sidePagination: 'server', onPostBody: function() { + // Add callback for 'delete' button + if (permissions.delete) { + $(table).find('.button-attachment-delete').click(function() { + let pk = $(this).attr('pk'); + let attachments = $(table).bootstrapTable('getRowByUniqueId', pk); + + deleteAttachments([attachments], url, options); + }); + } + // Add callback for 'edit' button if (permissions.change) { $(table).find('.button-attachment-edit').click(function() { - var pk = $(this).attr('pk'); + let pk = $(this).attr('pk'); constructForm(`${url}${pk}/`, { fields: {