Add 'allocated' column to Build detail view

This commit is contained in:
Oliver Walters 2019-05-07 23:31:41 +10:00
parent 29b94c91f3
commit 85869c07f6
2 changed files with 5 additions and 2 deletions

View File

@ -264,7 +264,8 @@ class Build(models.Model):
for item in self.part.bom_items.all():
part = {'part': item.sub_part,
'per_build': item.quantity,
'quantity': item.quantity * self.quantity
'quantity': item.quantity * self.quantity,
'allocated': self.getAllocatedQuantity(item.sub_part)
}
parts.append(part)

View File

@ -85,7 +85,8 @@
<tr>
<th>Part</th>
<th>Required</th>
<th>Stock</th>
<th>Available</th>
<th>Allocated</th>
</tr>
</thead>
<tbody>
@ -94,6 +95,7 @@
<td><a href="{% url 'part-detail' item.part.id %}">{{ item.part.name }}</a></td>
<td>{{ item.quantity }}</td>
<td>{{ item.part.total_stock }}</td>
<td>{{ item.allocated }}</td>
</tr>
{% endfor %}
</tbody>