mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-14 19:15:41 +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:
@ -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 %}
|
||||
|
Reference in New Issue
Block a user