Skip to content

Can Build ignores a BOM line's Piece Count #13085

Closed

Description

@Iweisc

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

  1. Create a component part with 20 units in stock.
  2. Open an assembly part with an empty BOM, open the Bill of Materials panel and click the edit button.
  3. Add a BOM item for the component with Quantity 2 and Piece Count 5, and submit.
  4. 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:

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

  1. added
    bug
    on Oct 24, 2026
  2. added this to the 1.7.0 milestone on Oct 24, 2026
  3. SchrodingersGat commented on Oct 24, 2026

    @SchrodingersGat
    Member

    @Iweisc thanks for reporting - fix incoming in #13090

  4. Iweisc commented on Oct 24, 2026

    @Iweisc
    Author

    @SchrodingersGat Just wanted to know if bugreels solved a pain point of reproduction 😊

  5. matmair commented on Oct 24, 2026

    @matmair
    Member

    @Iweisc is this an undisclosed advertisement? Are you associated with the mentioned Plattform?

  6. Iweisc commented on Oct 24, 2026

    @Iweisc
    Author

    @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. 😊

  7. Iweisc commented on Oct 24, 2026

    @Iweisc
    Author

    FYI, you can't use bugreels even if you want to without explicitly contacting us.

  8. matmair commented on Oct 24, 2026

    @matmair
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions