mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-09 07:00:56 +00:00
SupplierPart availability (#3148)
* Adds new fields to the SupplierPart model: - available - availability_updated * Allow availability_updated field to be blank * Revert "Remove stat context variables" This reverts commit0989c308d0
. * Increment API version * Adds availability information to the SupplierPart API serializer - If the 'available' field is updated, the current date is added to the availability_updated field * Add 'available' field to SupplierPart table * More JS refactoring * Add unit testing for specifying availability via the API * Display availability data on the SupplierPart detail page * Add ability to set 'available' quantity from the SupplierPart detail page * Revert "Revert "Remove stat context variables"" This reverts commit3f98037f79
.
This commit is contained in:
@ -189,14 +189,16 @@ function createSupplierPart(options={}) {
|
||||
|
||||
function editSupplierPart(part, options={}) {
|
||||
|
||||
var fields = supplierPartFields();
|
||||
var fields = options.fields || supplierPartFields();
|
||||
|
||||
// Hide the "part" field
|
||||
fields.part.hidden = true;
|
||||
if (fields.part) {
|
||||
fields.part.hidden = true;
|
||||
}
|
||||
|
||||
constructForm(`/api/company/part/${part}/`, {
|
||||
fields: fields,
|
||||
title: '{% trans "Edit Supplier Part" %}',
|
||||
title: options.title || '{% trans "Edit Supplier Part" %}',
|
||||
onSuccess: options.onSuccess
|
||||
});
|
||||
}
|
||||
@ -952,6 +954,21 @@ function loadSupplierPartTable(table, url, options) {
|
||||
title: '{% trans "Packaging" %}',
|
||||
sortable: false,
|
||||
},
|
||||
{
|
||||
field: 'available',
|
||||
title: '{% trans "Available" %}',
|
||||
sortable: true,
|
||||
formatter: function(value, row) {
|
||||
if (row.availability_updated) {
|
||||
var html = formatDecimal(value);
|
||||
var date = renderDate(row.availability_updated, {showTime: true});
|
||||
html += `<span class='fas fa-info-circle float-right' title='{% trans "Last Updated" %}: ${date}'></span>`;
|
||||
return html;
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'actions',
|
||||
title: '',
|
||||
|
Reference in New Issue
Block a user