From 82c6d10c3368294d011fe1f61a275104f7c8ef12 Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walters@gmail.com>
Date: Tue, 11 May 2021 17:11:07 +1000
Subject: [PATCH] Add translateable status codes for StockHistory

---
 InvenTree/InvenTree/status_codes.py | 76 +++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/InvenTree/InvenTree/status_codes.py b/InvenTree/InvenTree/status_codes.py
index c73ef10018..53b747a9ad 100644
--- a/InvenTree/InvenTree/status_codes.py
+++ b/InvenTree/InvenTree/status_codes.py
@@ -224,6 +224,82 @@ class StockStatus(StatusCode):
     ]
 
 
+class StockHistoryCode(StatusCode):
+
+    LEGACY = 0
+
+    CREATED = 1
+
+    # Manual editing operations
+    EDITED = 5
+    ASSIGNED_SERIAL = 6
+
+    # Manual stock operations
+    STOCK_COUNT = 10
+    STOCK_ADD = 11
+    STOCK_REMOVE = 12
+
+    # Location operations
+    STOCK_MOVE = 20
+
+    # Installation operations
+    INSTALLED_INTO_ASSEMBLY = 30
+    REMOVED_FROM_ASSEMBLY = 31
+
+    INSTALLED_CHILD_ITEM = 35
+    REMOVED_CHILD_ITEM = 36
+
+    # Stock splitting operations
+    SPLIT_FROM_PARENT = 40
+    SPLIT_CHILD_ITEM = 42
+
+    # Build order codes
+    BUILD_OUTPUT_CREATED = 50
+    BUILD_OUTPUT_COMPLETED = 55
+
+    # Sales order codes
+
+    # Purchase order codes
+    RECEIVED_AGAINST_PURCHASE_ORDER = 70
+
+    # Customer actions
+    SENT_TO_CUSTOMER = 100
+    RETURNED_FROM_CUSTOMER = 105
+
+    options = {
+        LEGACY: _('Legacy stock tracking entry'),
+
+        CREATED: _('Stock item created'),
+
+        EDITED: _('Edited stock item'),
+        ASSIGNED_SERIAL: _('Assigned serial number'),
+
+        STOCK_COUNT: _('Stock counted'),
+        STOCK_ADD: _('Stock manually added'),
+        STOCK_REMOVE: _('Stock manually removed'),
+
+        STOCK_MOVE: _('Location changed'),
+
+        INSTALLED_INTO_ASSEMBLY: _('Installed into assembly'),
+        REMOVED_FROM_ASSEMBLY: _('Removed from assembly'),
+
+        INSTALLED_CHILD_ITEM: _('Installed component item'),
+        REMOVED_CHILD_ITEM: _('Removed component item'),
+
+        SPLIT_FROM_PARENT: _('Split from parent item'),
+        SPLIT_CHILD_ITEM: _('Split child item'),
+
+        SENT_TO_CUSTOMER: _('Sent to customer'),
+        RETURNED_FROM_CUSTOMER: _('Returned from customer'),
+
+        BUILD_OUTPUT_CREATED: _('Build order output created'),
+        BUILD_OUTPUT_COMPLETED: _('Build order output completed'),
+
+        RECEIVED_AGAINST_PURCHASE_ORDER: _('Received against purchase order')
+
+    }
+
+
 class BuildStatus(StatusCode):
 
     # Build status codes