From b595f3b73243e1c3cd0ae0eec36990fba360ffaf Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 8 Oct 2020 14:05:55 +1100 Subject: [PATCH 1/2] Normalize quantity field when exporting BOM --- InvenTree/part/admin.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/InvenTree/part/admin.py b/InvenTree/part/admin.py index fce80eb219..f0c9e3f233 100644 --- a/InvenTree/part/admin.py +++ b/InvenTree/part/admin.py @@ -15,6 +15,8 @@ from .models import PartParameterTemplate, PartParameter from .models import PartTestTemplate from .models import PartSellPriceBreak +from InvenTree.helpers import normalize + from stock.models import StockLocation from company.models import SupplierPart @@ -165,6 +167,15 @@ class BomItemResource(ModelResource): # Is the sub-part itself an assembly? sub_assembly = Field(attribute='sub_part__assembly', readonly=True) + def dehydrate_quantity(self, item): + """ + Special consideration for the 'quantity' field on data export. + We do not want a spreadsheet full of "1.0000" (we'd rather "1") + + Ref: https://django-import-export.readthedocs.io/en/latest/getting_started.html#advanced-data-manipulation-on-export + """ + return normalize(item.quantity) + def before_export(self, queryset, *args, **kwargs): self.is_importing = kwargs.get('importing', False) From 8b16304e841f83d4d776d8536678244f44795325 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 8 Oct 2020 14:09:08 +1100 Subject: [PATCH 2/2] Custom 404 page --- InvenTree/templates/404.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 InvenTree/templates/404.html diff --git a/InvenTree/templates/404.html b/InvenTree/templates/404.html new file mode 100644 index 0000000000..3cb6464d99 --- /dev/null +++ b/InvenTree/templates/404.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block page_title %} +InvenTree | {% trans "Page Not Found" %} +{% endblock %} + +{% block content %} + +
+

{% trans "Page Not Found" %}

+ +
+ {% trans "The requested page does not exist" %} +
+
+ +{% endblock %} \ No newline at end of file