2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-13 10:35:40 +00:00

Further improvements to build allocation form

- Auto-allocation button ignores outputs which are complete
- StockItem API allows filtering by BomItem
- Quantity inputs are now auto-filled
- Display progress bar in the modal form
This commit is contained in:
Oliver
2021-10-05 08:25:10 +11:00
parent 0c04bfaa85
commit ae0efe73d1
9 changed files with 117 additions and 54 deletions

View File

@ -2329,6 +2329,23 @@ class BomItem(models.Model):
def get_api_url():
return reverse('api-bom-list')
def get_stock_filter(self):
"""
Return a queryset filter for selecting StockItems which match this BomItem
- If allow_variants is True, allow all part variants
"""
# Target part
part = self.sub_part
if self.allow_variants:
variants = part.get_descendants(include_self=True)
return Q(part__in=[v.pk for v in variants])
else:
return Q(part=part)
def save(self, *args, **kwargs):
self.clean()