mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #384 from SchrodingersGat/build-allocation-fixes
Build allocation fixes
This commit is contained in:
commit
937763f961
@ -45,7 +45,7 @@ class BuildItemSerializer(InvenTreeModelSerializer):
|
||||
|
||||
part = serializers.IntegerField(source='stock_item.part.pk', read_only=True)
|
||||
part_name = serializers.CharField(source='stock_item.part.full_name', read_only=True)
|
||||
part_image = serializers.CharField(source='stock_item.part.image.url', read_only=True)
|
||||
part_image = serializers.CharField(source='stock_item.part.image', read_only=True)
|
||||
stock_item_detail = StockItemSerializerBrief(source='stock_item', read_only=True)
|
||||
|
||||
class Meta:
|
||||
|
@ -62,30 +62,7 @@ InvenTree | Allocate Parts
|
||||
|
||||
{% else %}
|
||||
|
||||
$("#build-item-table").bootstrapTable({
|
||||
url: "{% url 'api-build-item-list' %}",
|
||||
queryParams: {
|
||||
build: {{ build.id }},
|
||||
},
|
||||
search: true,
|
||||
columns: [
|
||||
{
|
||||
field: 'part_name',
|
||||
title: 'Part',
|
||||
formatter: function(value, row, index, field) {
|
||||
return imageHoverIcon(row.part_image) + value;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'stock_item_detail.location_name',
|
||||
title: 'Location',
|
||||
},
|
||||
{
|
||||
field: 'quantity',
|
||||
title: 'Quantity Allocated',
|
||||
},
|
||||
]
|
||||
});
|
||||
$("#build-list").bootstrapTable({});
|
||||
|
||||
$("#btn-allocate").click(function() {
|
||||
location.href = "{% url 'build-allocate' build.id %}?edit=1";
|
||||
|
@ -1,6 +1,6 @@
|
||||
<h4>Allocate Stock to Build</h4>
|
||||
|
||||
<div class='row'>
|
||||
<h4>Allocate Stock to Build</h4>
|
||||
<div class='col-sm-6'>
|
||||
</div>
|
||||
<div class='col-sm-6'>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h4>Stock Allocated to Build</h4>
|
||||
<h4>Required Parts</h4>
|
||||
|
||||
<div id='#build-item-toolbar'>
|
||||
<div class='btn-group'>
|
||||
@ -6,5 +6,28 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class='table table-condensed table-striped' id='build-item-table' data-toolbar='#build-item-toolbar'>
|
||||
<table class='table table-striped table-condensed' id='build-list' data-sorting='true' data-toolbar='#build-item-toolbar'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Part</th>
|
||||
<th>Description</th>
|
||||
<th>Available</th>
|
||||
<th>Required</th>
|
||||
<th>Allocated</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in build.required_parts %}
|
||||
<tr>
|
||||
<td>
|
||||
{% include "hover_image.html" with image=item.part.image hover=True %}
|
||||
<a class='hover-icon'a href="{% url 'part-detail' item.part.id %}">{{ item.part.full_name }}</a>
|
||||
</td>
|
||||
<td>{{ item.part.description }}</td>
|
||||
<td>{{ item.part.total_stock }}</td>
|
||||
<td>{{ item.quantity }}</td>
|
||||
<td>{{ item.allocated }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
@ -6,7 +6,7 @@
|
||||
{% block collapse_panel_setup %}class='panel part-allocation' id='allocation-panel-{{ item.sub_part.id }}'{% endblock %}
|
||||
|
||||
{% block collapse_title %}
|
||||
{% include "hover_image.html" with image=item.sub_part.image %}
|
||||
{% include "hover_image.html" with image=item.sub_part.image hover=false %}
|
||||
<div>
|
||||
{{ item.sub_part.full_name }}
|
||||
<small><i>{{ item.sub_part.description }}</i></small>
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
{% block collapse_heading %}
|
||||
<div class='col-sm-2'>
|
||||
<b>{{ item.sub_part.available_stock }}</b>
|
||||
<b>{{ item.sub_part.total_stock }}</b>
|
||||
</div>
|
||||
<div class='col-sm-2'>
|
||||
<b>{% multiply build.quantity item.quantity %}</b>
|
||||
|
@ -21,7 +21,7 @@ Automatically allocate stock to this build?
|
||||
{% for item in allocations %}
|
||||
<tr>
|
||||
<td>
|
||||
{% include "hover_image.html" with image=item.stock_item.part.image %}
|
||||
{% include "hover_image.html" with image=item.stock_item.part.image hover=True %}
|
||||
</td>
|
||||
<td>
|
||||
{{ item.stock_item.part.full_name }}<br>
|
||||
|
@ -42,7 +42,7 @@ InvenTree | Build - {{ build }}
|
||||
{% if bom_price %}
|
||||
{{ bom_price }}
|
||||
{% if build.part.has_complete_bom_pricing == False %}
|
||||
<span class='warning-msg'><i>BOM pricing is incomplete</i></span>
|
||||
<br><span class='warning-msg'><i>BOM pricing is incomplete</i></span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class='warning-msg'><i>No pricing information</i></span>
|
||||
@ -81,8 +81,6 @@ InvenTree | Build - {{ build }}
|
||||
|
||||
</div>
|
||||
|
||||
{% include "modals.html" %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
|
@ -18,7 +18,7 @@ The following items will be removed from stock:
|
||||
{% for item in taking %}
|
||||
<tr>
|
||||
<td>
|
||||
{% include "hover_image.html" with image=item.stock_item.part.image %}
|
||||
{% include "hover_image.html" with image=item.stock_item.part.image hover=True %}
|
||||
</td>
|
||||
<td>
|
||||
{{ item.stock_item.part.full_name }}<br>
|
||||
@ -35,7 +35,7 @@ No parts have been allocated to this build.
|
||||
<hr>
|
||||
The following items will be created:
|
||||
<div class='panel panel-default'>
|
||||
{% include "hover_image.html" with image=build.part.image %}
|
||||
{% include "hover_image.html" with image=build.part.image hover=True %}
|
||||
{{ build.quantity }} x {{ build.part.full_name }}
|
||||
</div>
|
||||
|
||||
|
@ -29,8 +29,6 @@ InvenTree | Build List
|
||||
|
||||
{% include "build/build_list.html" with builds=cancelled title="Cancelled Builds" completed=False collapse_id="cancelled" %}
|
||||
|
||||
{% include 'modals.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
|
@ -1,41 +0,0 @@
|
||||
{% extends "build/build_base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block details %}
|
||||
|
||||
{% include "build/tabs.html" with tab='required' %}
|
||||
|
||||
<h4>Required Parts</h4>
|
||||
<table class='table table-striped table-condensed' id='build-list' data-sorting='true'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Part</th>
|
||||
<th>Available</th>
|
||||
<th>Required</th>
|
||||
<th>Allocated</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in build.required_parts %}
|
||||
<tr>
|
||||
<td>
|
||||
{% include "hover_image.html" with image=item.part.image %}
|
||||
<a class='hover-icon'a href="{% url 'part-detail' item.part.id %}">{{ item.part.full_name }}</a>
|
||||
</td>
|
||||
<td>{{ item.part.total_stock }}</td>
|
||||
<td>{{ item.quantity }}</td>
|
||||
<td>{{ item.allocated }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
|
||||
{{ block.super }}
|
||||
|
||||
$("#build-list").bootstrapTable({});
|
||||
|
||||
{% endblock %}
|
@ -2,11 +2,8 @@
|
||||
<li{% if tab == 'details' %} class='active'{% endif %}>
|
||||
<a href="{% url 'build-detail' build.id %}">Details</a>
|
||||
</li>
|
||||
<li{% if tab == 'required' %} class='active'{% endif %}>
|
||||
<a href="{% url 'build-required' build.id %}">Required</a>
|
||||
</li>
|
||||
<li{% if tab == 'allocate' %} class='active'{% endif %}>
|
||||
<a href="{% url 'build-allocate' build.id %}">Allocate</a>
|
||||
<a href="{% url 'build-allocate' build.id %}">Parts</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -24,8 +24,6 @@ build_detail_urls = [
|
||||
url(r'^auto-allocate/?', views.BuildAutoAllocate.as_view(), name='build-auto-allocate'),
|
||||
url(r'^unallocate/', views.BuildUnallocate.as_view(), name='build-unallocate'),
|
||||
|
||||
url(r'^required/', views.BuildDetail.as_view(template_name='build/required.html'), name='build-required'),
|
||||
|
||||
url(r'^.*$', views.BuildDetail.as_view(), name='build-detail'),
|
||||
]
|
||||
|
||||
|
@ -294,6 +294,8 @@ class BuildAllocate(DetailView):
|
||||
context['part'] = part
|
||||
context['bom_items'] = bom_items
|
||||
|
||||
context['bom_price'] = build.part.get_price_info(build.quantity, buy=False)
|
||||
|
||||
if str2bool(self.request.GET.get('edit', None)):
|
||||
context['editing'] = True
|
||||
|
||||
|
@ -68,8 +68,6 @@ InvenTree | Company - {{ company.name }}
|
||||
|
||||
</div>
|
||||
|
||||
{% include 'modals.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_load %}
|
||||
|
@ -26,10 +26,6 @@ InvenTree | Supplier List
|
||||
<table class='table table-striped' id='company-table' data-toolbar='#button-toolbar'>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
{% include 'modals.html' %}
|
||||
|
||||
{% endblock %}
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
@ -103,10 +103,6 @@ InvenTree | {{ company.name }} - Parts
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
{% include 'modals.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
|
@ -109,8 +109,6 @@
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
{% include 'modals.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
|
@ -33,7 +33,7 @@
|
||||
{% for variant in part.variants.all %}
|
||||
<tr>
|
||||
<td>
|
||||
{% include "hover_image.html" with image=variant.image %}
|
||||
{% include "hover_image.html" with image=variant.image hover=True %}
|
||||
<a href="{% url 'part-detail' variant.id %}">{{ variant.full_name }}</a>
|
||||
</td>
|
||||
<td>{{ variant.description }}</td>
|
||||
|
@ -46,8 +46,6 @@
|
||||
|
||||
{% include "stock_table.html" %}
|
||||
|
||||
{% include 'modals.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_load %}
|
||||
|
@ -17,7 +17,7 @@
|
||||
</tr>
|
||||
{% for item in stock_items %}
|
||||
<tr id='stock-row-{{ item.id }}' class='error'>
|
||||
<td>{% include "hover_image.html" with image=item.part.image %}
|
||||
<td>{% include "hover_image.html" with image=item.part.image hover=True %}
|
||||
{{ item.part.full_name }} <small><i>{{ item.part.description }}</i></small></td>
|
||||
<td>{{ item.location.pathstring }}</td>
|
||||
<td>
|
||||
|
@ -8,8 +8,6 @@
|
||||
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='tracking-table'>
|
||||
</table>
|
||||
|
||||
{% include 'modals.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
|
@ -1,12 +1,12 @@
|
||||
{% load static %}
|
||||
|
||||
<div class='hover-icon media-left' style='float: left;'>
|
||||
{% if image %}
|
||||
<div class='media-left' style='float: left;'>
|
||||
{% if hover %}
|
||||
<a class='hover-icon'>
|
||||
{% endif %}
|
||||
<img class='hover-img-thumb' {% if image %}src='{{ image.url }}'{% else %}src='{% static "img/blank_image.png" %}'{% endif %}>
|
||||
{% if image %}
|
||||
<img class='hover-img-large' src='{{ image.url }}'>
|
||||
{% if hover %}
|
||||
<img class='hover-img-large' {% if image %}src='{{ image.url }}'{% else %}src='{% static "img/blank_image.png" %}'{% endif %}>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user