Repository navigation
Description
Please verify that this bug has NOT been raised before.
- I checked and didn't find a similar issue
Describe the bug*
Watch in BugReels (the BOM line is entered with Quantity 2 and Piece Count 5 at 5:50, the BOM table shows Can Build 10 at 7:24, and Part Details shows Can Build 10 at 12:44)
Can Build ignores a BOM line's Piece Count. For a line with Quantity 2 and Piece Count 5, and 20 units of the component in stock, the BOM table and Part Details say 10 assemblies can be built. Only 2 can.
Steps to Reproduce
- Create a component part with 20 units in stock.
- Open an assembly part with an empty BOM, open the Bill of Materials panel and click the edit button.
- Add a BOM item for the component with Quantity 2 and Piece Count 5, and submit.
- Read Can Build in the BOM table, then in Part Details.
Expected behaviour
Can Build is 2. The Piece Count help text says "Total material = quantity x piece_count", so each assembly needs 10 units. Build orders already multiply by Piece Count, so a build order for the 10 assemblies the app reports would ask for 100 units.
Actual: the BOM row shows Quantity 2, Available Stock 20 and Can Build 10, and Part Details shows Can Build 10. GET /api/bom/ returns piece_count: 5, available_stock: 20 and can_build: 10 for the line.
The can_build annotation divides by quantity * (1 + attrition / 100) and leaves out piece_count:
InvenTree/src/backend/InvenTree/part/filters.py
Lines 551 to 556 in ae1f822
| can_build=Greatest( | |
| ExpressionWrapper( | |
| Case( | |
| When(Q(quantity=0), then=Value(0)), | |
| default=(F('total_stock') - F('setup_quantity')) | |
| / (F('quantity') * (1.0 + F('attrition') / 100.0)), |
BomItem.can_build_quantity (part/models.py line 3449) has the same omission, while get_required_quantity (line 3470) multiplies by piece_count. Piece Count came in with #12422.
Deployment Method
Other - added info in Steps to Reproduce
Version Information
Reproduced on demo.inventree.org on 2026-10-19 (1.7.0 dev, API 560). The current demo and master (ae1f822) have the same code. Current demo version information:
InvenTree-Version: 1.7.0 dev
API-Version: 562
Commit Hash: 3c644dd
Commit Date: 2026-10-23
Python Version: 3.14.8
Django Version: 5.2.17
Docker Mode: True
Try to reproduce on the demo site
I tried to reproduce
Is the bug reproducible on the demo site?
Reproducible
I have reviewed this report for correctness and filled out all sections.
- I have checked this report. I acknowledge that filing bugs via AI agents without review might lead to being blocked.
This report was drafted with Claude Code (Claude Opus 5.5) and reviewed before filing. The bug was reproduced on the demo, and the cause was checked against the linked source.
Activity
SchrodingersGat commentedon Oct 24, 2026
@Iweisc thanks for reporting - fix incoming in #13090
Iweisc commentedon Oct 24, 2026
@SchrodingersGat Just wanted to know if bugreels solved a pain point of reproduction 😊
matmair commentedon Oct 24, 2026
@Iweisc is this an undisclosed advertisement? Are you associated with the mentioned Plattform?
Iweisc commentedon Oct 24, 2026
@matmair I am the CTO of Bugreels, (Not yet incorporated or funded). I wouldn't call this an "ad", we didn't even launch yet, i'm just trying to collect feedback to validate that this actually solves a painpoint for developers. 😊
Iweisc commentedon Oct 24, 2026
FYI, you can't use bugreels even if you want to without explicitly contacting us.
matmair commentedon Oct 24, 2026
Seeing how many different projects you made reports on in a short time I would qualify this as an advertisement campaign, as other maintainers did too.