2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 04:55:44 +00:00

Distinct query fix (#5916)

* Fix "allocated" query for stock items

* Use distinct() elsewhere

* Add unit test to check distinct query results
This commit is contained in:
Oliver
2023-11-15 10:18:26 +11:00
committed by GitHub
parent 5be6bc8940
commit fe0d9c1923
6 changed files with 119 additions and 16 deletions

View File

@ -1012,7 +1012,7 @@ class Build(MPTTModel, InvenTree.mixins.DiffMixin, InvenTree.models.InvenTreeBar
)
# Filter out "serialized" stock items, these cannot be auto-allocated
available_stock = available_stock.filter(Q(serial=None) | Q(serial=''))
available_stock = available_stock.filter(Q(serial=None) | Q(serial='')).distinct()
if location:
# Filter only stock items located "below" the specified location