mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +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:
@ -11,6 +11,7 @@
|
||||
<table class='table table-striped table-condensed'>
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_REFERENCE_PATTERN" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_EDIT_COMPLETED_ORDERS" icon='fa-edit' %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
@ -13,6 +13,7 @@
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="SALESORDER_REFERENCE_PATTERN" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="SALESORDER_DEFAULT_SHIPMENT" icon="fa-truck-loading" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="SALESORDER_EDIT_COMPLETED_ORDERS" icon='fa-edit' %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -2084,6 +2084,11 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
|
||||
options.params['order'] = options.order;
|
||||
options.params['part_detail'] = true;
|
||||
|
||||
// Override 'editing' if order is not pending
|
||||
if (!options.pending && !global_settings.PURCHASEORDER_EDIT_COMPLETED_ORDERS) {
|
||||
options.allow_edit = false;
|
||||
}
|
||||
|
||||
var filters = loadTableFilters('purchaseorderlineitem');
|
||||
|
||||
for (var key in options.params) {
|
||||
@ -2445,6 +2450,10 @@ function loadPurchaseOrderExtraLineTable(table, options={}) {
|
||||
|
||||
options.table = table;
|
||||
|
||||
if (!options.pending && !global_settings.PURCHASEORDER_EDIT_COMPLETED_ORDERS) {
|
||||
options.allow_edit = false;
|
||||
}
|
||||
|
||||
options.params = options.params || {};
|
||||
|
||||
if (!options.order) {
|
||||
@ -2561,9 +2570,11 @@ function loadPurchaseOrderExtraLineTable(table, options={}) {
|
||||
|
||||
var pk = row.pk;
|
||||
|
||||
html += makeIconButton('fa-clone', 'button-duplicate', pk, '{% trans "Duplicate line" %}');
|
||||
html += makeIconButton('fa-edit icon-blue', 'button-edit', pk, '{% trans "Edit line" %}');
|
||||
html += makeIconButton('fa-trash-alt icon-red', 'button-delete', pk, '{% trans "Delete line" %}', );
|
||||
if (options.allow_edit) {
|
||||
html += makeIconButton('fa-clone', 'button-duplicate', pk, '{% trans "Duplicate line" %}');
|
||||
html += makeIconButton('fa-edit icon-blue', 'button-edit', pk, '{% trans "Edit line" %}');
|
||||
html += makeIconButton('fa-trash-alt icon-red', 'button-delete', pk, '{% trans "Delete line" %}', );
|
||||
}
|
||||
|
||||
html += `</div>`;
|
||||
|
||||
@ -3740,6 +3751,10 @@ function loadSalesOrderLineItemTable(table, options={}) {
|
||||
|
||||
options.table = table;
|
||||
|
||||
if (!options.pending && !global_settings.SALESORDER_EDIT_COMPLETED_ORDERS) {
|
||||
options.allow_edit = false;
|
||||
}
|
||||
|
||||
options.params = options.params || {};
|
||||
|
||||
if (!options.order) {
|
||||
@ -3769,7 +3784,7 @@ function loadSalesOrderLineItemTable(table, options={}) {
|
||||
setupFilterList('salesorderlineitem', $(table), filter_target);
|
||||
|
||||
// Is the order pending?
|
||||
var pending = options.status == {{ SalesOrderStatus.PENDING }};
|
||||
var pending = options.pending;
|
||||
|
||||
// Has the order shipped?
|
||||
var shipped = options.status == {{ SalesOrderStatus.SHIPPED }};
|
||||
@ -4287,6 +4302,10 @@ function loadSalesOrderExtraLineTable(table, options={}) {
|
||||
|
||||
options.table = table;
|
||||
|
||||
if (!options.pending && !global_settings.SALESORDER_EDIT_COMPLETED_ORDERS) {
|
||||
options.allow_edit = false;
|
||||
}
|
||||
|
||||
options.params = options.params || {};
|
||||
|
||||
if (!options.order) {
|
||||
@ -4401,14 +4420,14 @@ function loadSalesOrderExtraLineTable(table, options={}) {
|
||||
|
||||
var html = `<div class='btn-group float-right' role='group'>`;
|
||||
|
||||
var pk = row.pk;
|
||||
|
||||
html += makeIconButton('fa-clone', 'button-duplicate', pk, '{% trans "Duplicate line" %}');
|
||||
html += makeIconButton('fa-edit icon-blue', 'button-edit', pk, '{% trans "Edit line" %}');
|
||||
html += makeIconButton('fa-trash-alt icon-red', 'button-delete', pk, '{% trans "Delete line" %}', );
|
||||
if (options.allow_edit) {
|
||||
var pk = row.pk;
|
||||
html += makeIconButton('fa-clone', 'button-duplicate', pk, '{% trans "Duplicate line" %}');
|
||||
html += makeIconButton('fa-edit icon-blue', 'button-edit', pk, '{% trans "Edit line" %}');
|
||||
html += makeIconButton('fa-trash-alt icon-red', 'button-delete', pk, '{% trans "Delete line" %}', );
|
||||
}
|
||||
|
||||
html += `</div>`;
|
||||
|
||||
return html;
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user