2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 20:45:44 +00:00

Index page for showing all purchase orders

This commit is contained in:
Oliver Walters
2019-06-04 23:59:15 +10:00
parent 4f1acddb5d
commit c49b8546f0
5 changed files with 75 additions and 4 deletions

View File

@ -0,0 +1,27 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<h4>Purchase Orders</h4>
<table class='table table-striped table-condensed' id='po-table'>
<tr>
<th>Reference</th>
<th>Company</th>
<th>Description</th>
<th>Status</th>
</tr>
{% for order in orders %}
<tr>
<td>{{ order }}</td>
<td>{{ order.supplier }}</td>
<td>{{ order.description }}</td>
<td>{% include "order/order_status.html" %}</td>
</tr>
{% endfor %}
</table>
{% endblock %}

20
InvenTree/order/urls.py Normal file
View File

@ -0,0 +1,20 @@
"""
URL lookup for the Order app. Provides URL endpoints for:
- List view of Purchase Orders
- Detail view of Purchase Orders
"""
from django.conf.urls import url, include
from . import views
purchase_order_urls = [
# Display complete list of purchase orders
url(r'^.*$', views.PurchaseOrderIndex.as_view(), name='purchase-order-index'),
]
order_urls = [
url(r'^purchase-order/', include(purchase_order_urls)),
]

View File

@ -1,3 +1,26 @@
from django.shortcuts import render
"""
Django views for interacting with Order app
"""
# Create your views here.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.views.generic import DetailView, ListView
from .models import PurchaseOrder
from InvenTree.status_codes import OrderStatus
class PurchaseOrderIndex(ListView):
model = PurchaseOrder
template_name = 'order/purchase_orders.html'
context_object_name = 'orders'
def get_context_data(self):
ctx = super().get_context_data()
ctx['OrderStatus'] = OrderStatus
return ctx