{% 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 %}
{% trans "Purchase Orders" %}
{{ order }}
{% endblock %}
{% block heading %}
{% trans "Purchase Order" %}: {{ order.reference }}
{% endblock %}
{% block actions %}
{% if user.is_staff and roles.purchase_order.change %}
{% url 'admin:order_purchaseorder_change' order.pk as url %}
{% include "admin_button.html" with url=url %}
{% endif %}
{% if roles.purchase_order.change %}
{% if order.status == PurchaseOrderStatus.PENDING and order.lines.count > 0 %}
{% elif order.status == PurchaseOrderStatus.PLACED %}
{% endif %}
{% endif %}
{% endblock actions %}
{% block thumbnail %}
{% endblock %}
{% block details %}
|
{% trans "Order Reference" %} |
{% settings_value 'PURCHASEORDER_REFERENCE_PREFIX' %}{{ order.reference }}{% include "clip.html"%} |
|
{% trans "Order Description" %} |
{{ order.description }}{% include "clip.html" %} |
|
{% trans "Order Status" %} |
{% purchase_order_status_label order.status %}
{% if order.is_overdue %}
{% trans "Overdue" %}
{% endif %}
|
{% endblock %}
{% block details_right %}
|
{% trans "Supplier" %} |
{{ order.supplier.name }}{% include "clip.html"%} |
{% if order.supplier_reference %}
|
{% trans "Supplier Reference" %} |
{{ order.supplier_reference }}{% include "clip.html"%} |
{% endif %}
{% if order.link %}
|
External Link |
{{ order.link }}{% include "clip.html"%} |
{% endif %}
|
{% trans "Created" %} |
{{ order.creation_date }}{{ order.created_by }} |
{% if order.issue_date %}
|
{% trans "Issued" %} |
{{ order.issue_date }} |
{% endif %}
{% if order.target_date %}
|
{% trans "Target Date" %} |
{{ order.target_date }} |
{% endif %}
{% if order.status == PurchaseOrderStatus.COMPLETE %}
|
{% trans "Received" %} |
{{ order.complete_date }}{{ order.received_by }} |
{% endif %}
{% if order.responsible %}
|
{% trans "Responsible" %} |
{{ order.responsible }} |
{% endif %}
{% 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 %}
{% if report_enabled %}
$('#print-order-report').click(function() {
printPurchaseOrderReports([{{ order.pk }}]);
});
{% endif %}
$("#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 %}