From 8d70d2f28a15519e672ad79a6839680d9bbad035 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 4 Jun 2019 23:14:57 +1000 Subject: [PATCH] Fix rendering of purchase order status codes --- InvenTree/company/views.py | 7 +++++++ InvenTree/order/templates/order/order_status.html | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/InvenTree/company/views.py b/InvenTree/company/views.py index cce518676a..f9e032cbe9 100644 --- a/InvenTree/company/views.py +++ b/InvenTree/company/views.py @@ -11,6 +11,7 @@ from django.views.generic import DetailView, ListView from django.forms import HiddenInput from InvenTree.views import AjaxCreateView, AjaxUpdateView, AjaxDeleteView +from InvenTree.status_codes import OrderStatus from .models import Company from .models import SupplierPart @@ -57,6 +58,12 @@ class CompanyDetail(DetailView): queryset = Company.objects.all() model = Company + def get_context_data(self, **kwargs): + ctx = super().get_context_data(**kwargs) + ctx['OrderStatus'] = OrderStatus + + return ctx + class CompanyImage(AjaxUpdateView): """ View for uploading an image for the Company """ diff --git a/InvenTree/order/templates/order/order_status.html b/InvenTree/order/templates/order/order_status.html index 46359e562d..3e3d2a1e08 100644 --- a/InvenTree/order/templates/order/order_status.html +++ b/InvenTree/order/templates/order/order_status.html @@ -1,10 +1,10 @@ -{% if order.status == order.PENDING %} +{% if order.status == OrderStatus.PENDING %} -{% elif order.status == order.PLACED %} +{% elif order.status == OrderStatus.PLACED %} -{% elif order.status == order.COMPLETE %} +{% elif order.status == OrderStatus.COMPLETE %} -{% elif order.status == order.CANCELLED or order.status == order.RETURNED %} +{% elif order.status == OrderStatus.CANCELLED or order.status == OrderStatus.RETURNED %} {% else %}