2
0
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 commit 0989c308d0.

* 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 commit 3f98037f79.
This commit is contained in:
Oliver
2022-06-08 21:49:07 +10:00
committed by GitHub
parent a8a543755f
commit 258957c14c
11 changed files with 272 additions and 26 deletions

View File

@ -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: '',