mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Tweaked build detail page
This commit is contained in:
parent
a2ff1d16f3
commit
dad594dc7a
@ -60,6 +60,20 @@ class Build(models.Model):
|
|||||||
# Notes can be attached to each build output
|
# Notes can be attached to each build output
|
||||||
notes = models.TextField(blank=True)
|
notes = models.TextField(blank=True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def required_parts(self):
|
||||||
|
parts = []
|
||||||
|
|
||||||
|
for item in self.part.bom_items.all():
|
||||||
|
part = {'part': item.sub_part,
|
||||||
|
'per_build': item.quantity,
|
||||||
|
'quantity': item.quantity * self.quantity
|
||||||
|
}
|
||||||
|
|
||||||
|
parts.append(part)
|
||||||
|
|
||||||
|
return parts
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
""" Is this build active?
|
""" Is this build active?
|
||||||
|
@ -46,11 +46,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for item in build.part.bom_items.all %}
|
{% for item in build.required_parts %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{% url 'part-detail' item.sub_part.id %}">{{ item.sub_part.name }}</a></td>
|
<td><a href="{% url 'part-detail' item.part.id %}">{{ item.part.name }}</a></td>
|
||||||
<td>{{ build.quantity }} × {{ item.quantity }}</td>
|
<td>{{ item.quantity }}</td>
|
||||||
<td>{{ item.sub_part.total_stock }}</td>
|
<td>{{ item.part.total_stock }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user