mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
commit
c9ecb10078
@ -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(
|
||||
|
@ -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:
|
||||
|
@ -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 }}")
|
||||
|
@ -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 %}
|
||||
|
@ -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>
|
||||
|
@ -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 %}
|
||||
|
@ -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 %}
|
@ -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 }} × {{ build.part.name }}</p>
|
||||
<p>Building {{ build.quantity }} × {{ 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>
|
||||
|
@ -7,7 +7,7 @@ Are you sure you want to delete company '{{ company.name }}'?
|
||||
If this supplier is deleted, these supplier part entries will also be deleted.</p>
|
||||
<ul class='list-group'>
|
||||
{% for part in company.parts.all %}
|
||||
<li class='list-group-item'><b>{{ part.SKU }}</b> - <i>{{ part.part.name }}</i></li>
|
||||
<li class='list-group-item'><b>{{ part.SKU }}</b> - <i>{{ part.part.full_name }}</i></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
@ -51,7 +51,7 @@
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'part_detail.name',
|
||||
field: 'part_detail.full_name',
|
||||
title: 'Part',
|
||||
formatter: function(value, row, index, field) {
|
||||
return imageHoverIcon(row.part_detail.image_url) + renderLink(value, '/part/' + row.part + '/suppliers/');
|
||||
@ -74,7 +74,18 @@
|
||||
sortable: true,
|
||||
field: 'MPN',
|
||||
title: 'MPN',
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'URL',
|
||||
title: 'URL',
|
||||
formatter: function(value, row, index, field) {
|
||||
if (value) {
|
||||
return renderLink(value, value);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
url: "{% url 'api-part-supplier-list' %}"
|
||||
});
|
||||
|
@ -37,7 +37,7 @@ InvenTree | {{ company.name }} - Parts
|
||||
<td>Internal Part</td>
|
||||
<td>
|
||||
{% if part.part %}
|
||||
<a href="{% url 'part-suppliers' part.part.id %}">{{ part.part.name }}</a>
|
||||
<a href="{% url 'part-suppliers' part.part.id %}">{{ part.part.full_name }}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -9,7 +9,7 @@ from .models import BomItem
|
||||
|
||||
class PartAdmin(ImportExportModelAdmin):
|
||||
|
||||
list_display = ('long_name', 'IPN', 'description', 'total_stock', 'category')
|
||||
list_display = ('full_name', 'description', 'total_stock', 'category')
|
||||
|
||||
|
||||
class PartCategoryAdmin(ImportExportModelAdmin):
|
||||
|
@ -202,14 +202,30 @@ class Part(models.Model):
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return "{n} - {d}".format(n=self.long_name, d=self.description)
|
||||
return "{n} - {d}".format(n=self.full_name, d=self.description)
|
||||
|
||||
@property
|
||||
def long_name(self):
|
||||
name = self.name
|
||||
def full_name(self):
|
||||
""" Format a 'full name' for this Part.
|
||||
|
||||
- IPN (if not null)
|
||||
- Part name
|
||||
- Part variant (if not null)
|
||||
|
||||
Elements are joined by the | character
|
||||
"""
|
||||
|
||||
elements = []
|
||||
|
||||
if self.IPN:
|
||||
elements.append(self.IPN)
|
||||
|
||||
elements.append(self.name)
|
||||
|
||||
if self.variant:
|
||||
name += " | " + self.variant
|
||||
return name
|
||||
elements.append(self.variant)
|
||||
|
||||
return ' | '.join(elements)
|
||||
|
||||
def get_absolute_url(self):
|
||||
""" Return the web URL for viewing this part """
|
||||
@ -480,7 +496,7 @@ class Part(models.Model):
|
||||
for it in self.bom_items.all():
|
||||
line = []
|
||||
|
||||
line.append(it.sub_part.name)
|
||||
line.append(it.sub_part.full_name)
|
||||
line.append(it.sub_part.description)
|
||||
line.append(it.quantity)
|
||||
line.append(it.note)
|
||||
@ -611,8 +627,8 @@ class BomItem(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return "{n} x {child} to make {parent}".format(
|
||||
parent=self.part.name,
|
||||
child=self.sub_part.name,
|
||||
parent=self.part.full_name,
|
||||
child=self.sub_part.full_name,
|
||||
n=self.quantity)
|
||||
|
||||
|
||||
|
@ -34,14 +34,13 @@ class PartBriefSerializer(serializers.ModelSerializer):
|
||||
|
||||
url = serializers.CharField(source='get_absolute_url', read_only=True)
|
||||
image_url = serializers.CharField(source='get_image_url', read_only=True)
|
||||
|
||||
|
||||
class Meta:
|
||||
model = Part
|
||||
fields = [
|
||||
'pk',
|
||||
'url',
|
||||
'name',
|
||||
'variant',
|
||||
'full_name',
|
||||
'description',
|
||||
'available_stock',
|
||||
'image_url',
|
||||
@ -63,6 +62,7 @@ class PartSerializer(serializers.ModelSerializer):
|
||||
fields = [
|
||||
'pk',
|
||||
'url', # Link to the part detail page
|
||||
'full_name',
|
||||
'name',
|
||||
'variant',
|
||||
'image_url',
|
||||
@ -86,7 +86,7 @@ class PartSerializer(serializers.ModelSerializer):
|
||||
class PartStarSerializer(InvenTreeModelSerializer):
|
||||
""" Serializer for a PartStar object """
|
||||
|
||||
partname = serializers.CharField(source='part.name', read_only=True)
|
||||
partname = serializers.CharField(source='part.full_name', read_only=True)
|
||||
username = serializers.CharField(source='user.username', read_only=True)
|
||||
|
||||
class Meta:
|
||||
@ -145,6 +145,7 @@ class SupplierPartSerializer(serializers.ModelSerializer):
|
||||
'SKU',
|
||||
'manufacturer',
|
||||
'MPN',
|
||||
'URL',
|
||||
]
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
{% for allocation in part.build_allocation %}
|
||||
<tr>
|
||||
<td><a href="{% url 'build-detail' allocation.build.id %}">{{ allocation.build.title }}</a></td>
|
||||
<td>{{ allocation.build.quantity }} × <a href="{% url 'part-detail' allocation.build.part.id %}">{{ allocation.build.part.name }}</a></td>
|
||||
<td>{{ allocation.build.quantity }} × <a href="{% url 'part-detail' allocation.build.part.id %}">{{ allocation.build.part.full_name }}</a></td>
|
||||
<td>{{ allocation.quantity }}</td>
|
||||
<td>{% include "build_status.html" with build=allocation.build %}</td>
|
||||
</tr>
|
||||
|
@ -4,6 +4,6 @@ Deleting this entry will remove the BOM row from the following part:
|
||||
|
||||
<ul class='list-group'>
|
||||
<li class='list-group-item'>
|
||||
<b>{{ item.part.name }}</b> - <i>{{ item.part.description }}</i>
|
||||
<b>{{ item.part.full_name }}</b> - <i>{{ item.part.description }}</i>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
<h3>BOM Item</h3>
|
||||
<table class="table table-striped">
|
||||
<tr><td>Parent</td><td><a href="{% url 'part-bom' item.part.id %}">{{ item.part.name }}</a></td></tr>
|
||||
<tr><td>Child</td><td><a href="{% url 'part-used-in' item.sub_part.id %}">{{ item.sub_part.name }}</a></td></tr>
|
||||
<tr><td>Parent</td><td><a href="{% url 'part-bom' item.part.id %}">{{ item.part.full_name }}</a></td></tr>
|
||||
<tr><td>Child</td><td><a href="{% url 'part-used-in' item.sub_part.id %}">{{ item.sub_part.full_name }}</a></td></tr>
|
||||
<tr><td>Quantity</td><td>{{ item.quantity }}</td></tr>
|
||||
</table>
|
||||
|
||||
|
@ -27,7 +27,7 @@ the top level 'Parts' category.
|
||||
</p>
|
||||
<ul class='list-group'>
|
||||
{% for part in category.parts.all %}
|
||||
<li class='list-group-item'><b>{{ part.long_name }}</b> - <i>{{ part.description }}</i></li>
|
||||
<li class='list-group-item'><b>{{ part.full_name }}</b> - <i>{{ part.description }}</i></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
@ -10,7 +10,7 @@
|
||||
<ul class='list-group'>
|
||||
{% for match in matches %}
|
||||
<li class='list-group-item list-group-item-condensed'>
|
||||
{{ match.part.name }} - <i>{{ match.part.description }}</i> ({{ match.ratio }}%)
|
||||
{{ match.part.full_name }} - <i>{{ match.part.description }}</i> ({{ match.ratio }}%)
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
@ -16,7 +16,6 @@
|
||||
{% if part.active %}
|
||||
<li><a href='#' id='duplicate-part' title='Duplicate Part'>Duplicate</a></li>
|
||||
<li><a href="#" id='edit-part' title='Edit part'>Edit</a></li>
|
||||
<li><a href='#' id='stocktake-part' title='Stocktake'>Stocktake</a></li>
|
||||
<hr>
|
||||
<li><a href="#" id='deactivate-part' title='Deactivate part'>Deactivate</a></li>
|
||||
{% else %}
|
||||
@ -34,7 +33,7 @@
|
||||
<table class='table table-striped'>
|
||||
<tr>
|
||||
<td>Part name</td>
|
||||
<td>{{ part.long_name }}</td>
|
||||
<td>{{ part.full_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
@ -46,6 +45,12 @@
|
||||
<td>{{ part.IPN }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if part.URL %}
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td><a href="{{ part.URL }}">{{ part.URL }}</a></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<td>Category</td>
|
||||
<td>
|
||||
@ -147,7 +152,7 @@
|
||||
$('#activate-part').click(function() {
|
||||
showQuestionDialog(
|
||||
'Activate Part?',
|
||||
'Are you sure you wish to reactivate {{ part.long_name }}?',
|
||||
'Are you sure you wish to reactivate {{ part.full_name }}?',
|
||||
{
|
||||
accept_text: 'Activate',
|
||||
accept: function() {
|
||||
@ -169,7 +174,7 @@
|
||||
$('#deactivate-part').click(function() {
|
||||
showQuestionDialog(
|
||||
'Deactivate Part?',
|
||||
`Are you sure you wish to deactivate {{ part.long_name }}?<br>
|
||||
`Are you sure you wish to deactivate {{ part.full_name }}?<br>
|
||||
`,
|
||||
{
|
||||
accept_text: 'Deactivate',
|
||||
@ -198,16 +203,4 @@
|
||||
});
|
||||
});
|
||||
|
||||
$('#stocktake-part').click(function() {
|
||||
adjustStock({
|
||||
action: 'stocktake',
|
||||
query: {
|
||||
part: {{ part.id }},
|
||||
},
|
||||
success: function() {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
{% endblock %}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{% block page_title %}
|
||||
{% if part %}
|
||||
InvenTree | Part - {{ part.long_name }}
|
||||
InvenTree | Part - {{ part.full_name }}
|
||||
{% elif category %}
|
||||
InvenTree | Part Category - {{ category }}
|
||||
{% else %}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<div class="row">
|
||||
{% if part.active == False %}
|
||||
<div class='alert alert-danger' style='display: block;'>
|
||||
This part ({{ part.long_name }}) is not active:
|
||||
This part ({{ part.full_name }}) is not active:
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="col-sm-6">
|
||||
@ -24,7 +24,7 @@
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h4>
|
||||
{{ part.long_name }}
|
||||
{{ part.full_name }}
|
||||
</h4>
|
||||
{% if part.variant %}
|
||||
<p>Variant: {{ part.variant }}</p>
|
||||
|
@ -1,10 +1,10 @@
|
||||
Are you sure you want to delete part '{{ part.long_name }}'?
|
||||
Are you sure you want to delete part '{{ part.full_name }}'?
|
||||
|
||||
{% if part.used_in_count %}
|
||||
<p>This part is used in BOMs for {{ part.used_in_count }} other parts. If you delete this part, the BOMs for the following parts will be updated:
|
||||
<ul class="list-group">
|
||||
{% for child in part.used_in.all %}
|
||||
<li class='list-group-item'>{{ child.part.name }} - {{ child.part.description }}</li>
|
||||
<li class='list-group-item'>{{ child.part.full_name }} - {{ child.part.description }}</li>
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
@ -30,5 +30,5 @@ Are you sure you want to delete part '{{ part.long_name }}'?
|
||||
{% endif %}
|
||||
|
||||
{% if part.serials.all|length > 0 %}
|
||||
<p>There are {{ part.serials.all|length }} unique parts tracked for '{{ part.long_name }}'. Deleting this part will permanently remove this tracking information.</p>
|
||||
<p>There are {{ part.serials.all|length }} unique parts tracked for '{{ part.full_name }}'. Deleting this part will permanently remove this tracking information.</p>
|
||||
{% endif %}
|
@ -48,7 +48,7 @@
|
||||
$("#supplier-table").bootstrapTable({
|
||||
sortable: true,
|
||||
search: true,
|
||||
formatNoMatches: function() { return "No supplier parts available for {{ part.long_name }}"; },
|
||||
formatNoMatches: function() { return "No supplier parts available for {{ part.full_name }}"; },
|
||||
queryParams: function(p) {
|
||||
return {
|
||||
part: {{ part.id }}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{% include 'part/tabs.html' with tab='track' %}
|
||||
|
||||
Part tracking for {{ part.long_name }}
|
||||
Part tracking for {{ part.full_name }}
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
|
@ -27,7 +27,7 @@
|
||||
$("#used-table").bootstrapTable({
|
||||
sortable: true,
|
||||
search: true,
|
||||
formatNoMatches: function() { return "{{ part.long_name }} is not used to make any other parts"; },
|
||||
formatNoMatches: function() { return "{{ part.full_name }} is not used to make any other parts"; },
|
||||
queryParams: function(p) {
|
||||
return {
|
||||
sub_part: {{ part.id }}
|
||||
@ -43,7 +43,7 @@
|
||||
field: 'part_detail',
|
||||
title: 'Part',
|
||||
formatter: function(value, row, index, field) {
|
||||
return imageHoverIcon(row.part_detail.image_url) + renderLink(value.name, value.url + 'bom/');
|
||||
return imageHoverIcon(row.part_detail.image_url) + renderLink(value.full_name, value.url + 'bom/');
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ function loadBomTable(table, options) {
|
||||
title: 'Part',
|
||||
sortable: true,
|
||||
formatter: function(value, row, index, field) {
|
||||
return imageHoverIcon(value.image_url) + renderLink(value.name, value.url);
|
||||
return imageHoverIcon(value.image_url) + renderLink(value.full_name, value.url);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -123,11 +123,7 @@ function loadPartTable(table, url, options={}) {
|
||||
title: 'Part',
|
||||
sortable: true,
|
||||
formatter: function(value, row, index, field) {
|
||||
var name = row.name;
|
||||
|
||||
if (row.variant) {
|
||||
name = name + " | " + row.variant;
|
||||
}
|
||||
var name = row.full_name;
|
||||
|
||||
var display = imageHoverIcon(row.image_url) + renderLink(name, row.url);
|
||||
if (!row.active) {
|
||||
|
@ -393,7 +393,7 @@ function loadStockTable(table, options) {
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
field: 'part.name',
|
||||
field: 'part.full_name',
|
||||
title: 'Part',
|
||||
sortable: true,
|
||||
formatter: function(value, row, index, field) {
|
||||
|
@ -180,7 +180,7 @@ class StockItem(models.Model):
|
||||
reverse('api-stock-detail', kwargs={'pk': self.id}),
|
||||
{
|
||||
'part_id': self.part.id,
|
||||
'part_name': self.part.name
|
||||
'part_name': self.part.full_name
|
||||
}
|
||||
)
|
||||
|
||||
@ -464,7 +464,7 @@ class StockItem(models.Model):
|
||||
def __str__(self):
|
||||
s = '{n} x {part}'.format(
|
||||
n=self.quantity,
|
||||
part=self.part.name)
|
||||
part=self.part.full_name)
|
||||
|
||||
if self.location:
|
||||
s += ' @ {loc}'.format(loc=self.location.name)
|
||||
|
@ -32,7 +32,7 @@ class StockItemSerializerBrief(serializers.ModelSerializer):
|
||||
""" Brief serializers for a StockItem """
|
||||
|
||||
location_name = serializers.CharField(source='location', read_only=True)
|
||||
part_name = serializers.CharField(source='part.name', read_only=True)
|
||||
part_name = serializers.CharField(source='part.full_name', read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = StockItem
|
||||
|
@ -5,7 +5,7 @@
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
<h3>Stock Item Details</h3>
|
||||
<p><i>{{ item.quantity }} × {{ item.part.name }}</i></p>
|
||||
<p><i>{{ item.quantity }} × {{ item.part.full_name }}</i></p>
|
||||
<p>
|
||||
<div class='btn-group'>
|
||||
{% include "qr_button.html" %}
|
||||
@ -39,7 +39,7 @@
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<td>Part</td>
|
||||
<td><a href="{% url 'part-stock' item.part.id %}">{{ item.part.name }}</td>
|
||||
<td><a href="{% url 'part-stock' item.part.id %}">{{ item.part.full_name }}</td>
|
||||
</tr>
|
||||
{% if item.belongs_to %}
|
||||
<tr>
|
||||
|
@ -2,4 +2,4 @@ Are you sure you want to delete this stock item?
|
||||
|
||||
<br>
|
||||
|
||||
This will remove <b>{{ item.quantity }}</b> units of <b>{{ item.part.name }}</b> from stock.
|
||||
This will remove <b>{{ item.quantity }}</b> units of <b>{{ item.part.full_name }}</b> from stock.
|
||||
|
@ -30,7 +30,7 @@ If this location is deleted, these items will be moved to the top level 'Stock'
|
||||
|
||||
<ul class='list-group'>
|
||||
{% for item in location.stock_items.all %}
|
||||
<li class='list-group-item'><b>{{ item.part.name }}</b> - <i>{{ item.part.description }}</i><span class='badge'>{{ item.quantity }}</span></li>
|
||||
<li class='list-group-item'><b>{{ item.part.full_name }}</b> - <i>{{ item.part.description }}</i><span class='badge'>{{ item.quantity }}</span></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
@ -8,7 +8,7 @@
|
||||
</tr>
|
||||
{% for part in parts %}
|
||||
<tr>
|
||||
<td><a href="{% url 'part-detail' part.id %}">{{ part.long_name }}</a></td>
|
||||
<td><a href="{% url 'part-detail' part.id %}">{{ part.full_name }}</a></td>
|
||||
<td>{{ part.description }}</td>
|
||||
<td>{{ part.total_stock }}</td>
|
||||
<td>{{ part.allocation_count }}</td>
|
||||
|
Loading…
Reference in New Issue
Block a user