From 6c68197e617d6a1a0d95a7ec96402d1140197917 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 27 Nov 2020 11:18:58 +1100 Subject: [PATCH] Allow part ordering from build view --- InvenTree/templates/js/build.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/InvenTree/templates/js/build.js b/InvenTree/templates/js/build.js index ab6f0e4e0a..a3c7bd5186 100644 --- a/InvenTree/templates/js/build.js +++ b/InvenTree/templates/js/build.js @@ -243,6 +243,22 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { }); }); + // Callback for 'buy' button + $(table).find('.button-buy').click(function() { + var pk = $(this).attr('pk'); + + var idx = $(this).closest('tr').attr('data-index'); + var row = $(table).bootstrapTable('getData')[idx]; + + launchModalForm('{% url "order-parts" %}', { + data: { + parts: [ + pk, + ] + } + }); + }); + // Callback for 'build' button $(table).find('.button-build').click(function() { var pk = $(this).attr('pk'); @@ -563,7 +579,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { } if (row.sub_part_detail.purchaseable) { - html += makeIconButton('fa-shopping-cart icon-blue', 'button-buy', row.sub_part, '{% trans "Order stock" %}', {disabled: true}); + html += makeIconButton('fa-shopping-cart icon-blue', 'button-buy', row.sub_part, '{% trans "Order stock" %}'); } html += makeIconButton('fa-sign-in-alt icon-green', 'button-add', row.sub_part, '{% trans "Allocate stock" %}');