{% extends "page_base.html" %} {% load i18n %} {% load static %} {% load inventree_extras %} {% load status_codes %} {% block page_title %} {% inventree_title %} | {% trans "Purchase Order" %} {% endblock %} {% block breadcrumbs %} {% endblock %} {% block thumbnail %} {% endblock %} {% block details %}

{% trans "Purchase Order" %}: {{ order.reference }} {% if user.is_staff and roles.purchase_order.change %} {% endif %}

{% purchase_order_status_label order.status large=True %} {% if order.is_overdue %} {% trans "Overdue" %} {% endif %}

{{ order.description }}{% include "clip.html"%}

{% if roles.purchase_order.change %}
{% if order.status == PurchaseOrderStatus.PENDING and order.lines.count > 0 %} {% elif order.status == PurchaseOrderStatus.PLACED %} {% endif %} {% endif %}
{% endblock %} {% block details_right %} {% if order.supplier_reference %} {% endif %} {% if order.link %} {% endif %} {% if order.issue_date %} {% endif %} {% if order.target_date %} {% endif %} {% if order.status == PurchaseOrderStatus.COMPLETE %} {% endif %} {% if order.responsible %} {% endif %}
{% trans "Order Reference" %} {% settings_value 'PURCHASEORDER_REFERENCE_PREFIX' %}{{ order.reference }}{% include "clip.html"%}
{% trans "Order Status" %} {% purchase_order_status_label order.status %} {% if order.is_overdue %} {% trans "Overdue" %} {% endif %}
{% trans "Supplier" %} {{ order.supplier.name }}{% include "clip.html"%}
{% trans "Supplier Reference" %} {{ order.supplier_reference }}{% include "clip.html"%}
External Link {{ order.link }}{% include "clip.html"%}
{% trans "Created" %} {{ order.creation_date }}{{ order.created_by }}
{% trans "Issued" %} {{ order.issue_date }}
{% trans "Target Date" %} {{ order.target_date }}
{% trans "Received" %} {{ order.complete_date }}{{ order.received_by }}
{% trans "Responsible" %} {{ order.responsible }}
{% endblock %} {% block js_ready %} {{ block.super }} {% if order.status == PurchaseOrderStatus.PENDING and order.lines.count > 0 %} $("#place-order").click(function() { launchModalForm("{% url 'po-issue' order.id %}", { reload: true, }); }); {% endif %} $('#print-order-report').click(function() { printPurchaseOrderReports([{{ order.pk }}]); }); $("#edit-order").click(function() { constructForm('{% url "api-po-detail" order.pk %}', { fields: { reference: { prefix: global_settings.PURCHASEORDER_REFERENCE_PREFIX, }, {% if order.lines.count == 0 and order.status == PurchaseOrderStatus.PENDING %} supplier: { }, {% endif %} supplier_reference: {}, description: {}, target_date: { icon: 'fa-calendar-alt', }, link: { icon: 'fa-link', }, responsible: { icon: 'fa-user', }, }, title: '{% trans "Edit Purchase Order" %}', reload: true, }); }); $("#receive-order").click(function() { // Auto select items which have not been fully allocated var items = $("#po-line-table").bootstrapTable('getData'); var items_to_receive = []; items.forEach(function(item) { if (item.received < item.quantity) { items_to_receive.push(item); } }); receivePurchaseOrderItems( {{ order.id }}, items_to_receive, { success: function() { $("#po-line-table").bootstrapTable('refresh'); } } ); }); $("#complete-order").click(function() { launchModalForm("{% url 'po-complete' order.id %}", { reload: true, }); }); $("#cancel-order").click(function() { launchModalForm("{% url 'po-cancel' order.id %}", { reload: true, }); }); $("#export-order").click(function() { exportOrder('{% url "po-export" order.id %}'); }); {% endblock %}