2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00
- Add StockHistoryCode to custom context
- Add simple form for editing stock item history
- Add tracking entry when stock status is changed
This commit is contained in:
Oliver Walters
2021-05-11 23:38:26 +10:00
parent 84bfffd5a7
commit 03a231bffb
11 changed files with 119 additions and 16 deletions

View File

@ -1097,6 +1097,16 @@ function loadStockTrackingTable(table, options) {
// Status information
if (details.status) {
html += `<tr><th>{% trans "Status" %}</td>`;
html += '<td>';
html += stockStatusDisplay(
details.status,
{
classes: 'float-right',
}
);
html += '</td></tr>';
}
@ -1147,6 +1157,8 @@ function loadStockTrackingTable(table, options) {
}
});
/*
// 2021-05-11 - Ability to edit or delete StockItemTracking entries is now removed
cols.push({
sortable: false,
formatter: function(value, row, index, field) {
@ -1161,6 +1173,7 @@ function loadStockTrackingTable(table, options) {
}
}
});
*/
table.inventreeTable({
method: 'get',

View File

@ -3,6 +3,7 @@
{% load inventree_extras %}
{% include "status_codes.html" with label='stock' options=StockStatus.list %}
{% include "status_codes.html" with label='stockHistory' options=StockHistoryCode.list %}
{% include "status_codes.html" with label='build' options=BuildStatus.list %}
{% include "status_codes.html" with label='purchaseOrder' options=PurchaseOrderStatus.list %}
{% include "status_codes.html" with label='salesOrder' options=SalesOrderStatus.list %}

View File

@ -14,7 +14,7 @@ var {{ label }}Codes = {
* Uses the values specified in "status_codes.py"
* This function is generated by the "status_codes.html" template
*/
function {{ label }}StatusDisplay(key) {
function {{ label }}StatusDisplay(key, options={}) {
key = String(key);
@ -31,5 +31,11 @@ function {{ label }}StatusDisplay(key) {
label = '';
}
return `<span class='label ${label}'>${value}</span>`;
var classes = `label ${label}`;
if (options.classes) {
classes += ' ' + options.classes;
}
return `<span class='${classes}'>${value}</span>`;
}