From 06d9f4f9820989206d268a61b73894871402acf2 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 16 Dec 2020 21:02:53 +1100 Subject: [PATCH 01/10] Bugfix for duplicate IPN checks when blank IPN is used --- InvenTree/part/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index ea26e5e5c7..cf0c92899a 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -594,7 +594,7 @@ class Part(MPTTModel): # User can decide whether duplicate IPN (Internal Part Number) values are allowed allow_duplicate_ipn = common.models.InvenTreeSetting.get_setting('PART_ALLOW_DUPLICATE_IPN') - if not allow_duplicate_ipn: + if self.IPN is not None and not allow_duplicate_ipn: parts = Part.objects.filter(IPN__iexact=self.IPN) parts = parts.exclude(pk=self.pk) From bcae1d09a863aaddeabe4fb4abce42635c8d1596 Mon Sep 17 00:00:00 2001 From: eeintech Date: Thu, 17 Dec 2020 17:25:10 -0500 Subject: [PATCH 02/10] Fixed category parameter templates settings view --- InvenTree/part/api.py | 4 ++-- InvenTree/templates/InvenTree/settings/category.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index 9bf7294335..b479575a35 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -130,7 +130,7 @@ class CategoryParameters(generics.ListAPIView): """ try: - cat_id = int(self.request.query_params.get('category', None)) + cat_id = int(self.kwargs.get('pk', None)) except TypeError: cat_id = None fetch_parent = str2bool(self.request.query_params.get('fetch_parent', 'true')) @@ -910,8 +910,8 @@ part_api_urls = [ # Base URL for PartCategory API endpoints url(r'^category/', include([ + url(r'^(?P\d+)/parameters/?', CategoryParameters.as_view(), name='api-part-category-parameters'), url(r'^(?P\d+)/?', CategoryDetail.as_view(), name='api-part-category-detail'), - url(r'^parameters/?', CategoryParameters.as_view(), name='api-part-category-parameters'), url(r'^$', CategoryList.as_view(), name='api-part-category-list'), ])), diff --git a/InvenTree/templates/InvenTree/settings/category.html b/InvenTree/templates/InvenTree/settings/category.html index c84573e8b4..07dd0df342 100644 --- a/InvenTree/templates/InvenTree/settings/category.html +++ b/InvenTree/templates/InvenTree/settings/category.html @@ -45,7 +45,7 @@ {% if category %} $("#param-table").inventreeTable({ - url: "{% url 'api-part-category-parameters' category.pk %}", + url: "{% url 'api-part-category-parameters' pk=category.pk %}", queryParams: { ordering: 'name', }, @@ -58,7 +58,7 @@ switchable: false, }, { - field: 'parameter_template_detail.name', + field: 'parameter_template.name', title: '{% trans "Parameter Template" %}', sortable: 'true', }, From 1a48405491073667dbbd18647b6577365e20070b Mon Sep 17 00:00:00 2001 From: eeintech Date: Thu, 17 Dec 2020 17:37:54 -0500 Subject: [PATCH 03/10] Keep 'stock actions' button enabled when on children tab --- InvenTree/stock/templates/stock/item_base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index 5e9d26c5cf..74e93fecc0 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -114,7 +114,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }} {% if roles.stock.change and not item.is_building %}
- +
@@ -112,6 +113,14 @@ loadSalesOrderTable("#so-outstanding-table", { }, }); +loadSalesOrderTable("#so-overdue-table", { + url: "{% url 'api-so-list' %}", + params: { + overdue: true, + customer_detail: true, + } +}); + $("#latest-parts-table").on('load-success.bs.table', function() { var count = $("#latest-parts-table").bootstrapTable('getData').length; @@ -166,4 +175,10 @@ $("#so-outstanding-table").on('load-success.bs.table', function() { $("#so-outstanding-count").html(count); }); +$("#so-overdue-table").on('load-success.bs.table', function() { + var count = $("#so-overdue-table").bootstrapTable('getData').length; + + $("#so-overdue-count").html(count); +}); + {% endblock %} \ No newline at end of file diff --git a/InvenTree/templates/InvenTree/so_overdue.html b/InvenTree/templates/InvenTree/so_overdue.html new file mode 100644 index 0000000000..bf2b64a1e3 --- /dev/null +++ b/InvenTree/templates/InvenTree/so_overdue.html @@ -0,0 +1,15 @@ +{% extends "collapse_index.html" %} + +{% load i18n %} + +{% block collapse_title %} + +{% trans "Overdue Sales Orders" %} +{% endblock %} + +{% block collapse_content %} + + +
+ +{% endblock %} \ No newline at end of file From 13e924cc0533c0672ec1b269e9f7f47d3529a3c5 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 18 Dec 2020 16:10:55 +1100 Subject: [PATCH 09/10] Fix default value for PO and SO codes --- InvenTree/common/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 2f27dd602d..fa1d4dc5c9 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -153,11 +153,13 @@ class InvenTreeSetting(models.Model): 'SALESORDER_REFERENCE_PREFIX': { 'name': _('Sales Order Reference Prefix'), 'description': _('Prefix value for sales order reference'), + 'default': 'SO', }, 'PURCHASEORDER_REFERENCE_PREFIX': { 'name': _('Purchase Order Reference Prefix'), 'description': _('Prefix value for purchase order reference'), + 'default': 'PO', }, } From 08a8556fe76cb13f2e398ec8e56b371b604b89ae Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 18 Dec 2020 19:46:02 +1100 Subject: [PATCH 10/10] Fix unit testing --- InvenTree/order/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/InvenTree/order/tests.py b/InvenTree/order/tests.py index 7b118dc60e..47dfe63d0f 100644 --- a/InvenTree/order/tests.py +++ b/InvenTree/order/tests.py @@ -31,11 +31,11 @@ class OrderTest(TestCase): self.assertEqual(order.get_absolute_url(), '/order/purchase-order/1/') - self.assertEqual(str(order), 'PO 0001 - ACME') + self.assertEqual(str(order), 'PO0001 - ACME') line = PurchaseOrderLineItem.objects.get(pk=1) - self.assertEqual(str(line), "100 x ACME0001 from ACME (for PO 0001 - ACME)") + self.assertEqual(str(line), "100 x ACME0001 from ACME (for PO0001 - ACME)") def test_increment(self):