2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 20:45:44 +00:00

Add a 'full_name' field for Part

- Combines IPN | Name | Variant
- Use this to display in most views
This commit is contained in:
Oliver Walters
2019-05-12 12:16:04 +10:00
parent 08d743a735
commit 1d36ea3e2e
35 changed files with 81 additions and 78 deletions

View File

@ -225,7 +225,7 @@ class Build(models.Model):
'Removed {n} items to build {m} x {part}'.format(
n=item.quantity,
m=self.quantity,
part=self.part.name
part=self.part.full_name
)
)
@ -370,7 +370,7 @@ class BuildItem(models.Model):
if self.stock_item is not None and self.stock_item.part is not None:
if self.stock_item.part not in self.build.part.required_parts():
errors['stock_item'] = [_("Selected stock item not found in BOM for part '{p}'".format(p=self.build.part.name))]
errors['stock_item'] = [_("Selected stock item not found in BOM for part '{p}'".format(p=self.build.part.full_name))]
if self.stock_item is not None and self.quantity > self.stock_item.quantity:
errors['quantity'] = [_("Allocated quantity ({n}) must not exceed available quantity ({q})".format(

View File

@ -44,7 +44,7 @@ class BuildItemSerializer(InvenTreeModelSerializer):
""" Serializes a BuildItem object """
part = serializers.IntegerField(source='stock_item.part.pk', read_only=True)
part_name = serializers.CharField(source='stock_item.part.name', read_only=True)
part_name = serializers.CharField(source='stock_item.part.full_name', read_only=True)
stock_item_detail = StockItemSerializerBrief(source='stock_item', read_only=True)
class Meta:

View File

@ -14,7 +14,7 @@ InvenTree | Allocate Parts
<div class='col-sm-6'>
<h4><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></h4>
{{ build.quantity }} x {{ build.part.name }}
{{ build.quantity }} x {{ build.part.lonname }}
</div>
<div class='col-sm-6'>
<div class='btn-group' style='float: right;'>
@ -47,7 +47,7 @@ InvenTree | Allocate Parts
loadAllocationTable(
$("#allocate-table-id-{{ bom_item.sub_part.id }}"),
{{ bom_item.sub_part.id }},
"{{ bom_item.sub_part.name }}",
"{{ bom_item.sub_part.full_name }}",
"{% url 'api-build-item-list' %}?build={{ build.id }}&part={{ bom_item.sub_part.id }}",
{% multiply build.quantity bom_item.quantity %},
$("#new-item-{{ bom_item.sub_part.id }}")

View File

@ -9,7 +9,7 @@
<img class='hover-img-large' src="{% if item.sub_part.image %}{{ item.sub_part.image.url }}{% endif %}">
</div>
<div>
{{ item.sub_part.name }}<br>
{{ item.sub_part.full_name }}<br>
<small><i>{{ item.sub_part.description }}</i></small>
</div>
{% endblock %}

View File

@ -4,7 +4,7 @@
{{ block.super }}
<b>Build: {{ build.title }}</b> - {{ build.quantity }} x {{ build.part.name }}
<b>Build: {{ build.title }}</b> - {{ build.quantity }} x {{ build.part.full_name }}
<br><br>
Automatically allocate stock to this build?
<hr>
@ -27,7 +27,7 @@ Automatically allocate stock to this build?
</a>
</td>
<td>
{{ item.stock_item.part.name }}<br>
{{ item.stock_item.part.full_name }}<br>
<i>{{ item.stock_item.part.description }}</i>
</td>
<td>{{ item.quantity }}</td>

View File

@ -23,7 +23,7 @@
{% for build in builds %}
<tr>
<td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td>
<td><a href="{% url 'part-build' build.part.id %}">{{ build.part.name }}</a></td>
<td><a href="{% url 'part-build' build.part.id %}">{{ build.part.full_name }}</a></td>
<td>{{ build.quantity }}</td>
<td>{% include "build_status.html" with build=build %}
{% if completed %}

View File

@ -1,7 +1,7 @@
{% extends "modal_form.html" %}
{% block pre_form_content %}
<b>Build: {{ build.title }}</b> - {{ build.quantity }} x {{ build.part.name }}
<b>Build: {{ build.title }}</b> - {{ build.quantity }} x {{ build.part.full_name }}
<br>
Are you sure you want to mark this build as complete?
<hr>
@ -24,7 +24,7 @@ The following items will be removed from stock:
</a>
</td>
<td>
{{ item.stock_item.part.name }}<br>
{{ item.stock_item.part.full_name }}<br>
<i>{{ item.stock_item.part.description }}</i>
</td>
<td>{{ item.quantity }}</td>
@ -42,7 +42,7 @@ The following items will be created:
<img class='hover-img-thumb' src='{{ build.part.image.url }}'>
<img class='hover-img-large' src='{{ build.part.image.url }}'>
</a>
{{ build.quantity }} x {{ build.part.name }}
{{ build.quantity }} x {{ build.part.full_name }}
</div>
{% endblock %}

View File

@ -11,7 +11,7 @@ InvenTree | Build - {{ build }}
<div class='col-sm-6'>
<h3>Build Details</h3>
<p><b>{{ build.title }}</b>{% include "build_status.html" with build=build %}</p>
<p>Building {{ build.quantity }} &times {{ build.part.name }}</p>
<p>Building {{ build.quantity }} &times {{ build.part.full_name }}</p>
</div>
<div class='col-sm-6'>
<h3>
@ -40,7 +40,7 @@ InvenTree | Build - {{ build }}
<td>Title</td><td>{{ build.title }}</td>
</tr>
<tr>
<td>Part</td><td><a href="{% url 'part-build' build.part.id %}">{{ build.part.name }}</a></td>
<td>Part</td><td><a href="{% url 'part-build' build.part.id %}">{{ build.part.full_name }}</a></td>
</tr>
<tr>
<td>Quantity</td><td>{{ build.quantity }}</td>
@ -109,7 +109,7 @@ InvenTree | Build - {{ build }}
<tbody>
{% for item in build.required_parts %}
<tr>
<td><a href="{% url 'part-detail' item.part.id %}">{{ item.part.name }}</a></td>
<td><a href="{% url 'part-detail' item.part.id %}">{{ item.part.full_name }}</a></td>
<td>{{ item.quantity }}</td>
<td>{{ item.part.total_stock }}</td>
<td>{{ item.allocated }}</td>