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:
Oliver 2023-11-06 21:14:23 +11:00 committed by GitHub
parent 25598144ed
commit 4f8bca4ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 11 deletions

View File

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

View File

@ -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`.
@ -231,8 +229,8 @@ async function example_select(){
}
</script>
<form>
Number of Layers<br>
<form>
Number of Layers<br>
<input id="layer_number" type="number" value="2"><br>
Size of Board in mm<br>
<input id="string" type="text" value="100x160">

View File

@ -60,8 +60,8 @@ The current page base can be found [here](https://github.com/inventree/InvenTree
{% block js_ready %}
{{ block.super }}
enableSidebar('stocklocation');
{% endblock js_ready %}
{% endraw %}
```
```