2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 03:30:54 +00:00

Order editing updates (#3902)

* Add extra setting to guard whether purchase order items can be edited "after the fact"

* Improvements for "extra" purchase order line table

* Similar changes for sales order table

* Improvements for image download helper

(cherry picked from commit 43b0d3ca55)
This commit is contained in:
Oliver
2022-11-07 13:56:50 +11:00
committed by GitHub
parent 494a016dad
commit 1691f45578
7 changed files with 81 additions and 19 deletions

View File

@ -5,11 +5,13 @@
{% load i18n %}
{% load static %}
{% block sidebar %}
{% include 'order/po_sidebar.html' %}
{% endblock %}
{% block page_content %}
{% settings_value "PURCHASEORDER_EDIT_COMPLETED_ORDERS" as allow_extra_editing %}
<div class='panel panel-hidden' id='panel-order-items'>
<div class='panel-heading'>
@ -18,7 +20,7 @@
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% if roles.purchase_order.change %}
{% if order.status == PurchaseOrderStatus.PENDING %}
{% if order.is_pending or allow_extra_editing %}
<a class='btn btn-primary' href='{% url "po-upload" order.id %}' role='button'>
<span class='fas fa-file-upload side-icon'></span> {% trans "Upload File" %}
</a>
@ -48,11 +50,13 @@
<h4>{% trans "Extra Lines" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% if roles.purchase_order.change %}
{% if roles.purchase_order.change %}
{% if order.is_pending or allow_extra_editing %}
<button type='button' class='btn btn-success' id='new-po-extra-line'>
<span class='fas fa-plus-circle'></span> {% trans "Add Extra Line" %}
</button>
{% endif %}
{% endif %}
</div>
</div>
</div>
@ -209,6 +213,9 @@ loadPurchaseOrderLineItemTable('#po-line-table', {
{% else %}
allow_edit: false,
{% endif %}
{% if order.status == PurchaseOrderStatus.PENDING %}
pending: true,
{% endif %}
{% if order.status == PurchaseOrderStatus.PLACED and roles.purchase_order.change %}
allow_receive: true,
{% else %}
@ -241,6 +248,12 @@ loadPurchaseOrderExtraLineTable(
{
order: {{ order.pk }},
status: {{ order.status }},
{% if order.is_pending %}
pending: true,
{% endif %}
{% if roles.purchase_order.change %}
allow_edit: true,
{% endif %}
}
);

View File

@ -10,6 +10,7 @@
{% endblock %}
{% block page_content %}
{% settings_value "SALESORDER_EDIT_COMPLETED_ORDERS" as allow_extra_editing %}
<div class='panel panel-hidden' id='panel-order-items'>
<div class='panel-heading'>
@ -17,11 +18,13 @@
<h4>{% trans "Sales Order Items" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% if roles.sales_order.change and order.is_pending %}
{% if roles.sales_order.change %}
{% if order.is_pending or allow_extra_editing %}
<button type='button' class='btn btn-success' id='new-so-line'>
<span class='fas fa-plus-circle'></span> {% trans "Add Line Item" %}
</button>
{% endif %}
{% endif %}
</div>
</div>
</div>
@ -43,10 +46,12 @@
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% if roles.sales_order.change %}
{% if order.is_pending or allow_extra_editing %}
<button type='button' class='btn btn-success' id='new-so-extra-line'>
<span class='fas fa-plus-circle'></span> {% trans "Add Extra Line" %}
</button>
{% endif %}
{% endif %}
</div>
</div>
</div>
@ -265,6 +270,12 @@
order: {{ order.pk }},
reference: '{{ order.reference }}',
status: {{ order.status }},
{% if roles.sales_order.change %}
allow_edit: true,
{% endif %}
{% if order.is_pending %}
pending: true,
{% endif %}
}
);
@ -289,6 +300,8 @@
{
order: {{ order.pk }},
status: {{ order.status }},
{% if roles.sales_order.change %}allow_edit: true,{% endif %}
{% if order.is_pending %}pending: true,{% endif %}
}
);