Pre-fill allocation count

This commit is contained in:
Oliver Walters 2019-05-18 12:17:57 +10:00
parent 34d1ef7d8d
commit a95e77c429
2 changed files with 8 additions and 1 deletions

View File

@ -25,7 +25,7 @@
Allocated: Allocated:
</div> </div>
<div class='col-sm-1' id='allocation-panel-{{ item.sub_part.id }}'> <div class='col-sm-1' id='allocation-panel-{{ item.sub_part.id }}'>
<b><span id='allocation-total-{{ item.sub_part.id }}'>0</span></b> <b><span id='allocation-total-{{ item.sub_part.id }}'>{% part_allocation_count build item.sub_part %}</span></b>
</div> </div>
<div class='col-sm-2'> <div class='col-sm-2'>
<div class='btn-group' style='float: right;'> <div class='btn-group' style='float: right;'>

View File

@ -14,6 +14,13 @@ def multiply(x, y, *args, **kwargs):
return x * y return x * y
@register.simple_tag()
def part_allocation_count(build, part, *args, **kwargs):
""" Return the total number of <part> allocated to <build> """
return build.getAllocatedQuantity(part)
@register.simple_tag() @register.simple_tag()
def inventree_version(*args, **kwargs): def inventree_version(*args, **kwargs):
""" Return InvenTree version string """ """ Return InvenTree version string """