2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-12 07:54:14 +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

@ -1191,7 +1191,7 @@ function noResultBadge() {
function formatDate(row) {
// Function for formatting date field
var html = row.date;
var html = renderDate(row.date);
if (row.user_detail) {
html += `<span class='badge badge-right rounded-pill bg-secondary'>${row.user_detail.username}</span>`;
@ -1707,13 +1707,13 @@ function loadStockTable(table, options) {
val = '# ' + row.serial;
} else if (row.quantity != available) {
// Some quantity is available, show available *and* quantity
var ava = +parseFloat(available).toFixed(5);
var tot = +parseFloat(row.quantity).toFixed(5);
var ava = formatDecimal(available);
var tot = formatDecimal(row.quantity);
val = `${ava} / ${tot}`;
} else {
// Format floating point numbers with this one weird trick
val = +parseFloat(value).toFixed(5);
val = formatDecimal(value);
}
var html = renderLink(val, `/stock/item/${row.pk}/`);