From 8426f403a6d0ba82ddc5ab78fe90ddda28ce8228 Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@gmail.com>
Date: Wed, 2 Mar 2022 00:32:59 +1100
Subject: [PATCH] Merge pull request #2698 from
 SchrodingersGat/delete-serialized-stock

Allows deletion of serialized stock

(cherry picked from commit 0d2bfa6839a554bc9129f13e9e47638355a0d022)
---
 InvenTree/part/templates/part/part_base.html   | 4 ++--
 InvenTree/stock/models.py                      | 4 ----
 InvenTree/stock/templates/stock/item_base.html | 2 +-
 InvenTree/templates/stock_table.html           | 8 ++++----
 4 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html
index d2505a57f7..67baaf0636 100644
--- a/InvenTree/part/templates/part/part_base.html
+++ b/InvenTree/part/templates/part/part_base.html
@@ -59,13 +59,13 @@
     <ul class='dropdown-menu'>
         <li>
             <a class='dropdown-item' href='#' id='part-count'>
-                <span class='fas fa-clipboard-list'></span>
+                <span class='fas fa-check-circle icon-green'></span>
                 {% trans "Count part stock" %}
             </a>
         </li>
         <li>
             <a class='dropdown-item' href='#' id='part-move'>
-                <span class='fas fa-exchange-alt'></span>
+                <span class='fas fa-exchange-alt icon-blue'></span>
                 {% trans "Transfer part stock" %}
             </a>
         </li>
diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py
index 64b47da6d3..14132d297b 100644
--- a/InvenTree/stock/models.py
+++ b/InvenTree/stock/models.py
@@ -909,7 +909,6 @@ class StockItem(MPTTModel):
         """ Can this stock item be deleted? It can NOT be deleted under the following circumstances:
 
         - Has installed stock items
-        - Has a serial number and is tracked
         - Is installed inside another StockItem
         - It has been assigned to a SalesOrder
         - It has been assigned to a BuildOrder
@@ -918,9 +917,6 @@ class StockItem(MPTTModel):
         if self.installed_item_count() > 0:
             return False
 
-        if self.part.trackable and self.serial is not None:
-            return False
-
         if self.sales_order is not None:
             return False
 
diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html
index c52d101afb..4cf5741dac 100644
--- a/InvenTree/stock/templates/stock/item_base.html
+++ b/InvenTree/stock/templates/stock/item_base.html
@@ -66,7 +66,7 @@
         <ul class='dropdown-menu' role='menu'>
             {% if not item.serialized %}
             {% if item.in_stock %}
-            <li><a class='dropdown-item' href='#' id='stock-count' title='{% trans "Count stock" %}'><span class='fas fa-clipboard-list'></span> {% trans "Count stock" %}</a></li>
+            <li><a class='dropdown-item' href='#' id='stock-count' title='{% trans "Count stock" %}'><span class='fas fa-check-circle icon-green'></span> {% trans "Count stock" %}</a></li>
             {% endif %}
             {% if not item.customer %}
             <li><a class='dropdown-item' href='#' id='stock-add' title='{% trans "Add stock" %}'><span class='fas fa-plus-circle icon-green'></span> {% trans "Add stock" %}</a></li>
diff --git a/InvenTree/templates/stock_table.html b/InvenTree/templates/stock_table.html
index 4a20938869..a8a4ec6691 100644
--- a/InvenTree/templates/stock_table.html
+++ b/InvenTree/templates/stock_table.html
@@ -46,16 +46,16 @@
                 <ul class="dropdown-menu">
                     {% if roles.stock.change %}
                     <li><a class='dropdown-item' href="#" id='multi-item-add' title='{% trans "Add to selected stock items" %}'><span class='fas fa-plus-circle icon-green'></span> {% trans "Add stock" %}</a></li>
-                    <li><a class='dropdown-item' href="#" id='multi-item-remove' title='{% trans "Remove from selected stock items" %}'><span class='fas fa-minus-circle'></span> {% trans "Remove stock" %}</a></li>
-                    <li><a class='dropdown-item' href="#" id='multi-item-stocktake' title='{% trans "Stocktake selected stock items" %}'><span class='fas fa-check-circle'></span> {% trans "Count stock" %}</a></li>
-                    <li><a class='dropdown-item' href='#' id='multi-item-move' title='{% trans "Move selected stock items" %}'><span class='fas fa-exchange-alt'></span> {% trans "Move stock" %}</a></li>
+                    <li><a class='dropdown-item' href="#" id='multi-item-remove' title='{% trans "Remove from selected stock items" %}'><span class='fas fa-minus-circle icon-red'></span> {% trans "Remove stock" %}</a></li>
+                    <li><a class='dropdown-item' href="#" id='multi-item-stocktake' title='{% trans "Stocktake selected stock items" %}'><span class='fas fa-check-circle icon-green'></span> {% trans "Count stock" %}</a></li>
+                    <li><a class='dropdown-item' href='#' id='multi-item-move' title='{% trans "Move selected stock items" %}'><span class='fas fa-exchange-alt icon-blue'></span> {% trans "Transfer stock" %}</a></li>
                     <li><a class='dropdown-item' href='#' id='multi-item-merge' title='{% trans "Merge selected stock items" %}'><span class='fas fa-object-group'></span> {% trans "Merge stock" %}</a></li>
                     <li><a class='dropdown-item' href='#' id='multi-item-order' title='{% trans "Order selected items" %}'><span class='fas fa-shopping-cart'></span> {% trans "Order stock" %}</a></li>
                     <li><a class='dropdown-item' href='#' id='multi-item-assign' title='{% trans "Assign to customer" %}'><span class='fas fa-user-tie'></span> {% trans "Assign to customer" %}</a></li>
                     <li><a class='dropdown-item' href='#' id='multi-item-set-status' title='{% trans "Change status" %}'><span class='fas fa-exclamation-circle'></span> {% trans "Change stock status" %}</a></li>
                     {% endif %}
                     {% if roles.stock.delete %}
-                    <li><a class='dropdown-item' href='#' id='multi-item-delete' title='{% trans "Delete selected items" %}'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete Stock" %}</a></li>
+                    <li><a class='dropdown-item' href='#' id='multi-item-delete' title='{% trans "Delete selected items" %}'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete stock" %}</a></li>
                     {% endif %}
                     </ul>
                 </div>