From 1f6cbd74080f4af04ac38e439606f1aab37fc341 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 29 Sep 2020 23:11:37 +1000 Subject: [PATCH] Add action to uninstall a particular stock item --- .../stock/templates/stock/item_base.html | 26 +++++++++++++++++-- .../stock/templates/stock/item_installed.html | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index 18888e00c8..d62c3b29d2 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -107,6 +107,11 @@ InvenTree | {% trans "Stock Item" %} - {{ item }} {% if item.customer %}
  • {% trans "Return to stock" %}
  • {% endif %} + {% if item.belongs_to %} +
  • + {% trans "Uninstall" %} +
  • + {% endif %} @@ -165,8 +170,12 @@ InvenTree | {% trans "Stock Item" %} - {{ item }} {% if item.belongs_to %} - {% trans "Belongs To" %} - {{ item.belongs_to }} + + {% trans "Installed In" %} + + + {{ item.belongs_to }} + {% elif item.sales_order %} @@ -301,6 +310,19 @@ $("#stock-serialize").click(function() { ); }); +$('#stock-uninstall').click(function() { + + launchModalForm( + "{% url 'stock-item-uninstall' %}", + { + data: { + 'items[]': [{{ item.pk}}], + }, + reload: true, + } + ); +}); + $("#stock-test-report").click(function() { launchModalForm( "{% url 'stock-item-test-report-select' item.id %}", diff --git a/InvenTree/stock/templates/stock/item_installed.html b/InvenTree/stock/templates/stock/item_installed.html index 2d8a8142cf..cac55c9dce 100644 --- a/InvenTree/stock/templates/stock/item_installed.html +++ b/InvenTree/stock/templates/stock/item_installed.html @@ -128,7 +128,7 @@ $('#installed-table').inventreeTable({ var html = `
    `; - html += makeIconButton('fa-trash-alt icon-red', 'button-uninstall', pk, '{% trans "Uninstall item" %}'); + html += makeIconButton('fa-unlink', 'button-uninstall', pk, '{% trans "Uninstall item" %}'); html += `
    `;