mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
PO auto fill fix (#5871)
* Take "on_order" quantity into account when ordering items * Clean up panel.md * update urls.d
This commit is contained in:
parent
25598144ed
commit
4f8bca4ea4
@ -883,16 +883,24 @@ function orderParts(parts_list, options={}) {
|
||||
// Request 'requirements' information for each part
|
||||
inventreeGet(`{% url "api-part-list" %}${part.pk}/requirements/`, {}, {
|
||||
success: function(response) {
|
||||
var required = response.required || 0;
|
||||
var allocated = response.allocated || 0;
|
||||
var available = response.available_stock || 0;
|
||||
let required = response.required || 0;
|
||||
let allocated = response.allocated || 0;
|
||||
let available = response.available_stock || 0;
|
||||
let on_order = response.on_order || 0;
|
||||
|
||||
// Based on what we currently 'have' on hand, what do we need to order?
|
||||
var deficit = Math.max(required - allocated, 0);
|
||||
let deficit = Math.max(required - allocated, 0);
|
||||
|
||||
if (available < deficit) {
|
||||
var q = deficit - available;
|
||||
|
||||
// If we have some on order, subtract that from the quantity we need to order
|
||||
if (on_order > 0) {
|
||||
q -= on_order;
|
||||
}
|
||||
|
||||
q = Math.max(q, 0);
|
||||
|
||||
updateFieldValue(
|
||||
`quantity_${part.pk}`,
|
||||
q,
|
||||
|
@ -18,12 +18,10 @@ Each plugin which implements this mixin can return zero or more custom panels fo
|
||||
|
||||
Panel content can be rendered by returning HTML directly, or by rendering from a template file.
|
||||
|
||||
|
||||
Each plugin can register templates simply by providing a 'templates' directory in its root path.
|
||||
|
||||
The convention is that each 'templates' directory contains a subdirectory with the same name as the plugin (e.g. `templates/myplugin/my_template.html`)
|
||||
|
||||
|
||||
In this case, the template can then be loaded (from any plugin!) by loading `myplugin/my_template.html`.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user