From b5a5f5b4094b5eb59c4c63d50a6087110e300806 Mon Sep 17 00:00:00 2001
From: eeintech <eeintech@eeinte.ch>
Date: Thu, 8 Apr 2021 13:42:35 -0400
Subject: [PATCH 1/7] Simplified stock table view in Part and SupplierPart
 detail pages

---
 .../company/templates/company/supplier_part_stock.html   | 2 +-
 InvenTree/part/templates/part/stock.html                 | 2 +-
 InvenTree/templates/js/stock.js                          | 9 +++++++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/InvenTree/company/templates/company/supplier_part_stock.html b/InvenTree/company/templates/company/supplier_part_stock.html
index 49a5a809c2..524c508957 100644
--- a/InvenTree/company/templates/company/supplier_part_stock.html
+++ b/InvenTree/company/templates/company/supplier_part_stock.html
@@ -22,7 +22,7 @@
         params: {
             supplier_part: {{ part.id }},
             location_detail: true,
-            part_detail: true,
+            part_detail: false,
         },
         groupByField: 'location',
         buttons: ['#stock-options'],
diff --git a/InvenTree/part/templates/part/stock.html b/InvenTree/part/templates/part/stock.html
index cd4f9ab2fa..2d1385f89c 100644
--- a/InvenTree/part/templates/part/stock.html
+++ b/InvenTree/part/templates/part/stock.html
@@ -40,7 +40,7 @@
         params: {
             part: {{ part.id }},
             location_detail: true,
-            part_detail: true,
+            part_detail: false,
         },
         groupByField: 'location',
         buttons: [
diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js
index 02714810e3..cba3e56b35 100644
--- a/InvenTree/templates/js/stock.js
+++ b/InvenTree/templates/js/stock.js
@@ -241,7 +241,7 @@ function loadStockTable(table, options) {
 
     // List of user-params which override the default filters
 
-    options.params['part_detail'] = true;
+    // options.params['part_detail'] = true;
     options.params['location_detail'] = true;
 
     var params = options.params || {};
@@ -524,7 +524,8 @@ function loadStockTable(table, options) {
                 title: '{% trans "Part" %}',
                 sortName: 'part__name',
                 sortable: true,
-                switchable: false,
+                visible: params['part_detail'],
+                switchable: params['part_detail'],
                 formatter: function(value, row, index, field) {
 
                     var url = `/stock/item/${row.pk}/`;
@@ -543,6 +544,8 @@ function loadStockTable(table, options) {
                 title: 'IPN',
                 sortName: 'part__IPN',
                 sortable: true,
+                visible: params['part_detail'],
+                switchable: params['part_detail'],
                 formatter: function(value, row, index, field) {
                     return row.part_detail.IPN;
                 },
@@ -550,6 +553,8 @@ function loadStockTable(table, options) {
             {
                 field: 'part_detail.description',
                 title: '{% trans "Description" %}',
+                visible: params['part_detail'],
+                switchable: params['part_detail'],
                 formatter: function(value, row, index, field) {
                     return row.part_detail.description;
                 }

From 7491cda313cd512f21cd7bb1988ad45a734bec9e Mon Sep 17 00:00:00 2001
From: eeintech <eeintech@eeinte.ch>
Date: Thu, 8 Apr 2021 14:35:47 -0400
Subject: [PATCH 2/7] Replace normalize with integer wrapper for quantity field

---
 InvenTree/part/admin.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/InvenTree/part/admin.py b/InvenTree/part/admin.py
index 4681404ba1..d08d5f1eaa 100644
--- a/InvenTree/part/admin.py
+++ b/InvenTree/part/admin.py
@@ -180,7 +180,7 @@ class BomItemResource(ModelResource):
 
         Ref: https://django-import-export.readthedocs.io/en/latest/getting_started.html#advanced-data-manipulation-on-export
         """
-        return normalize(item.quantity)
+        return int(item.quantity)
 
     def before_export(self, queryset, *args, **kwargs):
 

From cbddda6640693d8b2a035f8a1e6dadff452ecbe5 Mon Sep 17 00:00:00 2001
From: eeintech <eeintech@eeinte.ch>
Date: Thu, 8 Apr 2021 14:41:06 -0400
Subject: [PATCH 3/7] Remove normalize import

---
 InvenTree/part/admin.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/InvenTree/part/admin.py b/InvenTree/part/admin.py
index d08d5f1eaa..eb728c5295 100644
--- a/InvenTree/part/admin.py
+++ b/InvenTree/part/admin.py
@@ -16,8 +16,6 @@ from .models import PartCategoryParameterTemplate
 from .models import PartTestTemplate
 from .models import PartSellPriceBreak
 
-from InvenTree.helpers import normalize
-
 from stock.models import StockLocation
 from company.models import SupplierPart
 

From 97e1bc0a67d18aa13e0b556607f067bffa1fc62b Mon Sep 17 00:00:00 2001
From: eeintech <eeintech@eeinte.ch>
Date: Thu, 8 Apr 2021 21:46:11 -0400
Subject: [PATCH 4/7] Added missing part_detail reference

---
 InvenTree/templates/InvenTree/index.html | 1 +
 InvenTree/templates/js/stock.js          | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/InvenTree/templates/InvenTree/index.html b/InvenTree/templates/InvenTree/index.html
index b7807840c5..f7154e5fbb 100644
--- a/InvenTree/templates/InvenTree/index.html
+++ b/InvenTree/templates/InvenTree/index.html
@@ -131,6 +131,7 @@ addHeaderAction('stock-to-build', '{% trans "Required for Build Orders" %}', 'fa
 
 loadStockTable($('#table-recently-updated-stock'), {
     params: {
+        part_detail: true,
         ordering: "-updated",
         max_results: {% settings_value "STOCK_RECENT_COUNT" %},
     },
diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js
index cba3e56b35..b163bc89f3 100644
--- a/InvenTree/templates/js/stock.js
+++ b/InvenTree/templates/js/stock.js
@@ -241,7 +241,6 @@ function loadStockTable(table, options) {
 
     // List of user-params which override the default filters
 
-    // options.params['part_detail'] = true;
     options.params['location_detail'] = true;
 
     var params = options.params || {};

From afddf12339c36b26f7dd3e7c200b9fe1b25f6ae9 Mon Sep 17 00:00:00 2001
From: eeintech <eeintech@eeinte.ch>
Date: Thu, 8 Apr 2021 22:04:26 -0400
Subject: [PATCH 5/7] Changed int to float

---
 InvenTree/part/admin.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/InvenTree/part/admin.py b/InvenTree/part/admin.py
index eb728c5295..af2f615803 100644
--- a/InvenTree/part/admin.py
+++ b/InvenTree/part/admin.py
@@ -178,7 +178,7 @@ class BomItemResource(ModelResource):
 
         Ref: https://django-import-export.readthedocs.io/en/latest/getting_started.html#advanced-data-manipulation-on-export
         """
-        return int(item.quantity)
+        return float(item.quantity)
 
     def before_export(self, queryset, *args, **kwargs):
 

From 6bf4140e5a4f311f4b289521c5c83bf6d99848db Mon Sep 17 00:00:00 2001
From: eeintech <eeintech@eeinte.ch>
Date: Fri, 9 Apr 2021 16:55:05 -0400
Subject: [PATCH 6/7] Fixed transfer stock action in template

---
 InvenTree/stock/templates/stock/item_base.html | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html
index a72b727f69..04518a0c65 100644
--- a/InvenTree/stock/templates/stock/item_base.html
+++ b/InvenTree/stock/templates/stock/item_base.html
@@ -165,13 +165,13 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
                 {% if item.in_stock %}
                 <li><a href='#' id='stock-remove' title='{% trans "Remove stock" %}'><span class='fas fa-minus-circle icon-red'></span> {% trans "Remove stock" %}</a></li>
                 {% endif %}
-                {% if item.in_stock and item.can_adjust_location %}
-                <li><a href='#' id='stock-move' title='{% trans "Transfer stock" %}'><span class='fas fa-exchange-alt icon-blue'></span> {% trans "Transfer stock" %}</a></li>
-                {% endif %}
                 {% if item.in_stock and item.part.trackable %}
                 <li><a href='#' id='stock-serialize' title='{% trans "Serialize stock" %}'><span class='fas fa-hashtag'></span> {% trans "Serialize stock" %}</a> </li>
                 {% endif %}
                 {% endif %}
+                {% if item.in_stock and item.can_adjust_location %}
+                <li><a href='#' id='stock-move' title='{% trans "Transfer stock" %}'><span class='fas fa-exchange-alt icon-blue'></span> {% trans "Transfer stock" %}</a></li>
+                {% endif %}
                 {% if item.in_stock and item.can_adjust_location and item.part.salable and not item.customer %}
                 <li><a href='#' id='stock-assign-to-customer' title='{% trans "Assign to customer" %}'><span class='fas fa-user-tie'></span> {% trans "Assign to customer" %}</a></li>
                 {% endif %}

From e6bd91c9e2fc72b380dd5212990a3796df5b467b Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walters@gmail.com>
Date: Sat, 10 Apr 2021 15:29:44 +1000
Subject: [PATCH 7/7] Company description is no longer a required field

---
 .../migrations/0033_auto_20210410_1528.py      | 18 ++++++++++++++++++
 InvenTree/company/models.py                    |  7 ++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 InvenTree/company/migrations/0033_auto_20210410_1528.py

diff --git a/InvenTree/company/migrations/0033_auto_20210410_1528.py b/InvenTree/company/migrations/0033_auto_20210410_1528.py
new file mode 100644
index 0000000000..12153a9ef6
--- /dev/null
+++ b/InvenTree/company/migrations/0033_auto_20210410_1528.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.0.7 on 2021-04-10 05:28
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('company', '0032_auto_20210403_1837'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='company',
+            name='description',
+            field=models.CharField(blank=True, help_text='Description of the company', max_length=500, verbose_name='Company description'),
+        ),
+    ]
diff --git a/InvenTree/company/models.py b/InvenTree/company/models.py
index 17091dcbc3..d83748c930 100644
--- a/InvenTree/company/models.py
+++ b/InvenTree/company/models.py
@@ -95,7 +95,12 @@ class Company(models.Model):
                             help_text=_('Company name'),
                             verbose_name=_('Company name'))
 
-    description = models.CharField(max_length=500, verbose_name=_('Company description'), help_text=_('Description of the company'))
+    description = models.CharField(
+        max_length=500,
+        verbose_name=_('Company description'),
+        help_text=_('Description of the company'),
+        blank=True,
+    )
 
     website = models.URLField(blank=True, verbose_name=_('Website'), help_text=_('Company website URL'))