mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Split display of purchase orders by company view
This commit is contained in:
parent
b8bcc5ce0c
commit
c132f275f5
@ -135,6 +135,16 @@ class Company(models.Model):
|
||||
""" Return purchase orders which are 'outstanding' """
|
||||
return self.purchase_orders.filter(status__in=OrderStatus.OPEN)
|
||||
|
||||
def closed_purchase_orders(self):
|
||||
""" Return purchase orders which are not 'outstanding'
|
||||
|
||||
- Complete
|
||||
- Failed / lost
|
||||
- Returned
|
||||
"""
|
||||
|
||||
return self.purchase_orders.exclude(status__in=OrderStatus.OPEN)
|
||||
|
||||
def complete_purchase_orders(self):
|
||||
return self.purchase_orders.filter(status=OrderStatus.COMPLETE)
|
||||
|
||||
|
@ -4,17 +4,13 @@
|
||||
|
||||
{% include 'company/tabs.html' with tab='po' %}
|
||||
|
||||
<h4>Purchase Orders</h4>
|
||||
<h4>Open Purchase Orders</h4>
|
||||
|
||||
{% include "order/po_table.html" with orders=company.outstanding_purchase_orders.all %}
|
||||
|
||||
{% if company.closed_purchase_orders.count > 0 %}
|
||||
{% include "order/po_table_collapse.html" with title="Closed Orders" orders=company.closed_purchase_orders.all %}
|
||||
{% endif %}
|
||||
|
||||
<table class='table table-striped table-condensed' id='po-table'>
|
||||
<tr>
|
||||
<th>Reference</th>
|
||||
<th>Description</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
{% include "company/po_list.html" with orders=company.outstanding_purchase_orders %}
|
||||
{% include "company/po_list.html" with orders=company.complete_purchase_orders %}
|
||||
{% include "company/po_list.html" with orders=company.failed_purchase_orders %}
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
@ -1,31 +0,0 @@
|
||||
{% extends "supplier/supplier_base.html" %}
|
||||
|
||||
{% block details %}
|
||||
|
||||
{% include "supplier/tabs.html" with tab='order' %}
|
||||
|
||||
<h3>Supplier Orders</h3>
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Reference</th>
|
||||
<th>Issued</th>
|
||||
<th>Delivery</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
{% for order in supplier.orders.all %}
|
||||
<tr>
|
||||
<td><a href="{% url 'supplier-order-detail' order.id %}">{{ order.internal_ref }}</a></td>
|
||||
<td>{% if order.issued_date %}{{ order.issued_date }}{% endif %}</td>
|
||||
<td>{% if order.delivery_date %}{{ order.delivery_date }}{% endif %}</td>
|
||||
<td>{% include "supplier/order_status.html" with order=order %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<div class='container-fluid'>
|
||||
<a href="{% url 'supplier-order-create' %}?supplier={{ supplier.id }}">
|
||||
<button class="btn btn-success">New Order</button>
|
||||
</a>
|
||||
|
||||
{% endblock %}
|
11
InvenTree/order/templates/order/po_table_collapse.html
Normal file
11
InvenTree/order/templates/order/po_table_collapse.html
Normal file
@ -0,0 +1,11 @@
|
||||
{% extends "collapse.html" %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block collapse_title %}
|
||||
<h4>{{ title }}</h4>
|
||||
{% endblock %}
|
||||
|
||||
{% block collapse_content %}
|
||||
{% include "order/po_table.html" %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user