mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Tweaked build detail page
This commit is contained in:
		@@ -60,6 +60,20 @@ class Build(models.Model):
 | 
			
		||||
    # Notes can be attached to each build output
 | 
			
		||||
    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
 | 
			
		||||
    def is_active(self):
 | 
			
		||||
        """ Is this build active?
 | 
			
		||||
 
 | 
			
		||||
@@ -46,11 +46,11 @@
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
<tbody>
 | 
			
		||||
    {% for item in build.part.bom_items.all %}
 | 
			
		||||
    {% for item in build.required_parts %}
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td><a href="{% url 'part-detail' item.sub_part.id %}">{{ item.sub_part.name }}</a></td>
 | 
			
		||||
        <td>{{ build.quantity }} × {{ item.quantity }}</td>
 | 
			
		||||
        <td>{{ item.sub_part.total_stock }}</td>
 | 
			
		||||
        <td><a href="{% url 'part-detail' item.part.id %}">{{ item.part.name }}</a></td>
 | 
			
		||||
        <td>{{ item.quantity }}</td>
 | 
			
		||||
        <td>{{ item.part.total_stock }}</td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    {% endfor %}
 | 
			
		||||
</tbody>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user