mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 04:55:44 +00:00
Allocate "non tracked" parts separately from tracked ones
This commit is contained in:
@ -177,4 +177,4 @@ class EditBuildAttachmentForm(HelperForm):
|
||||
'build',
|
||||
'attachment',
|
||||
'comment'
|
||||
]
|
||||
]
|
||||
|
@ -25,29 +25,39 @@ InvenTree | Allocate Parts
|
||||
<table class='table table-striped table-condensed' id='build-item-list' data-toolbar='#build-item-toolbar'></table>
|
||||
-->
|
||||
|
||||
|
||||
<h4>{% trans "Untracked Parts" %}</h4>
|
||||
<div class="panel-group" id="build-output-accordion" role="tablist" aria-multiselectable="true">
|
||||
{% for item in build.incomplete_outputs %}
|
||||
{% include "build/allocation_card.html" with item=item complete=False %}
|
||||
{% endfor %}
|
||||
{% include "build/allocation_card.html" %}
|
||||
</div>
|
||||
|
||||
{% if build.incomplete_outputs %}
|
||||
<h4>{% trans "Tracked Build Ouputs" %}</h4>
|
||||
<div class="panel-group" id="build-output-accordion" role="tablist" aria-multiselectable="true">
|
||||
{% for item in build.incomplete_outputs %}
|
||||
{% include "build/allocation_card.html" with item=item %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
{% for item in build.incomplete_outputs %}
|
||||
var buildInfo = {
|
||||
pk: {{ build.pk }},
|
||||
quantity: {{ build.quantity }},
|
||||
completed: {{ build.completed }},
|
||||
part: {{ build.part.pk }},
|
||||
};
|
||||
|
||||
loadBuildOutputAllocationTable(buildInfo, null);
|
||||
|
||||
{% for item in build.incomplete_outputs %}
|
||||
// Get the build output as a javascript object
|
||||
inventreeGet('{% url 'api-stock-detail' item.pk %}', {},
|
||||
{
|
||||
success: function(response) {
|
||||
loadBuildOutputAllocationTable(
|
||||
{{ build.pk }},
|
||||
{{ build.part.pk }},
|
||||
response
|
||||
);
|
||||
loadBuildOutputAllocationTable(buildInfo, response);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -1,33 +1,44 @@
|
||||
{% load i18n %}
|
||||
{% load inventree_extras %}
|
||||
|
||||
<div class="panel panel-default" id='allocation-panel-{{ item.pk }}'>
|
||||
<div class="panel-heading" role="tab" id="heading-{{ item.pk }}">
|
||||
{% if item %}
|
||||
{% define item.pk as pk %}
|
||||
{% else %}
|
||||
{% define 'untracked' as pk %}
|
||||
{% endif %}
|
||||
|
||||
<div class="panel panel-default" id='allocation-panel-{{ pk }}'>
|
||||
<div class="panel-heading" role="tab" id="heading-{{ pk }}">
|
||||
<div class="panel-title">
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
<a role="button" data-toggle="collapse" data-parent="#build-output-accordion" href="#collapse-{{ item.pk }}" aria-expanded="true" aria-controls="collapse-{{ item.pk }}">
|
||||
<a role="button" data-toggle="collapse" data-parent="#build-output-accordion" href="#collapse-{{ pk }}" aria-expanded="true" aria-controls="collapse-{{ pk }}">
|
||||
{% if item %}
|
||||
{{ item }}
|
||||
{% else %}
|
||||
{% trans "Untracked items" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
<div class='col-sm-3'>
|
||||
<div>
|
||||
{% trans "Completed lines" %}:
|
||||
<div id='output-progress-{{ item.pk }}'>
|
||||
<div id='output-progress-{{ pk }}'>
|
||||
<span class='fas fa-spin fa-spinner'></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-sm-3'>
|
||||
<div class='btn-group float-right' id='output-actions-{{ item.pk }}'>
|
||||
<div class='btn-group float-right' id='output-actions-{{ pk }}'>
|
||||
<span class='fas fa-spin fa-spinner'></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="collapse-{{ item.pk }}" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading-{{ item.pk }}">
|
||||
<div id="collapse-{{ pk }}" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading-{{ pk }}">
|
||||
<div class="panel-body">
|
||||
<table class='table table-striped table-condensed' id='allocation-table-{{ item.pk }}'></table>
|
||||
<table class='table table-striped table-condensed' id='allocation-table-{{ pk }}'></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -646,6 +646,16 @@ class BuildItemCreate(AjaxCreateView):
|
||||
"""
|
||||
pass
|
||||
|
||||
# If the sub_part is supplied, limit to matching stock items
|
||||
part_id = self.get_param('part')
|
||||
|
||||
if part_id:
|
||||
try:
|
||||
self.part = Part.objects.get(pk=part_id)
|
||||
|
||||
except (ValueError, Part.DoesNotExist):
|
||||
pass
|
||||
|
||||
# If the output stock item is specified, hide the input field
|
||||
output_id = form['install_into'].value()
|
||||
|
||||
@ -657,15 +667,10 @@ class BuildItemCreate(AjaxCreateView):
|
||||
except (ValueError, StockItem.DoesNotExist):
|
||||
pass
|
||||
|
||||
# If the sub_part is supplied, limit to matching stock items
|
||||
part_id = self.get_param('part')
|
||||
|
||||
if part_id:
|
||||
try:
|
||||
self.part = Part.objects.get(pk=part_id)
|
||||
|
||||
except (ValueError, Part.DoesNotExist):
|
||||
pass
|
||||
else:
|
||||
# If the output is not specified, but we know that the part is non-trackable, hide the install_into field
|
||||
if self.part and not self.part.trackable:
|
||||
form.fields['install_into'].widget = HiddenInput()
|
||||
|
||||
if self.build and self.part:
|
||||
available_items = self.build.getAvailableStockItems(part=self.part, output=self.output)
|
||||
|
Reference in New Issue
Block a user